xo::Table::YUIDataTableRenderer instproc render_yui_js (private)
<instance of xo::Table::YUIDataTableRenderer> render_yui_js
Defined in /var/www/openacs.org/packages/xowiki/tcl/yui-procs.tcl
Generates the JavaScript fragment, that is put below and (progressively enhances) the HTML table.
- Testcases:
- No testcase defined.
Source code: set container ${:id}_container set datasource ${:id}_datasource set datatable ${:id}_datatable set coldef ${:id}_coldef set finaljs "" set js "var $datasource = new YAHOO.util.DataSource(YAHOO.util.Dom.get('${:id}')); \n" append js "$datasource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; \n" append js "$datasource.responseSchema = \{ \n" append js " fields: \[ \n" set js_fields [list] foreach field [[self]::__columns children] { if {[$field hide]} continue lappend js_fields " \{ key: \"[$field set name]\" \}" } append js [join $js_fields ", "] " \] \n\};\n" append js "var $coldef = \[\n" set js_fields [list] foreach field [[self]::__columns children] { if {[$field hide]} continue if {[$field istype HiddenField]} continue if {[$field istype BulkAction]} { set subid [::xowiki::Includelet html_id $field] set label "<input type='checkbox' id='$subid'></input>" if {[info exists ::__csrf_token]} { append label "<input type='hidden' name='__csrf_token' value='$::__csrf_token'>" } set sortable false append finaljs [subst { document.getElementById('$subid').addEventListener('click', function (event) { acs_ListCheckAll('objects', this.checked); }, false); }] } else { set label [lang::util::localize [$field label]] set sortable [expr {[$field exists sortable] ? [$field set sortable] : true}] } lappend js_fields " \{ key: \"[$field set name]\" , sortable: $sortable, label: \"$label\" \}" } append js [join $js_fields ", "] "\];\n" append js "var $datatable = new YAHOO.widget.DataTable('$container', $coldef, $datasource);\n" append js $finaljs return $jsXQL Not present: Generic, PostgreSQL, Oracle