5e8e0ed53c05f2ef9b51ce897440bae308367f47
chmalee
  Wed Feb 9 14:45:54 2022 -0800
Add csv output option to table browser to support opening files in
Excel, refs #27623. Also change the output filename message to hint
that Excel can auto-recognize .csv extensions and behave appropriately.
Lastly, fix output dropdown selection to properly warn on update
when using GTF output option or a snp table.

diff --git src/lib/cheapcgi.c src/lib/cheapcgi.c
index 99f760f..b1270c0 100644
--- src/lib/cheapcgi.c
+++ src/lib/cheapcgi.c
@@ -180,30 +180,36 @@
 }
 
 void checkValidEvent(char *event)
 /* check if it is lowercase and a known valid event name */
 {
 char *temp = cloneString(event);
 tolowers(temp);
 if (!sameString(temp, event))
     warn("jsInline: javascript event %s should be given in lower-case", event);
 event = temp; 
 if (!findJsEvent(event))
     warn("jsInline: unknown javascript event %s", event);
 freeMem (event);
 }
 
+void jsAddEventForId(char *eventName, char *idText, char *jsText)
+{
+checkValidEvent(eventName);
+jsInlineF("document.getElementById('%s').addEventListener('%s', %s);\n", idText, eventName, jsText);
+}
+
 void jsOnEventById(char *eventName, char *idText, char *jsText)
 /* Add js mapping for inline event */
 {
 checkValidEvent(eventName);
 jsInlineF("document.getElementById('%s').on%s = function(event) {if (!event) {event=window.event}; %s};\n", idText, eventName, jsText);
 }
 
 void jsOnEventByIdF(char *eventName, char *idText, char *format, ...)
 /* Add js mapping for inline event with printf formatting */
 {
 checkValidEvent(eventName);
 jsInlineF("document.getElementById('%s').on%s = function(event) {if (!event) {event=window.event}; ", idText, eventName);
 va_list args;
 va_start(args, format);
 dyStringVaPrintf(jsInlineLines, format, args);