%3 ::xo::Table::YUIDataTableRenderer ::xo::Table::YUIDataTableRenderer render_yui_js ::xo::Table::TABLE3 ::xo::Table::TABLE3 ::xo::Table::YUIDataTableRenderer->::xo::Table::TABLE3 ::xo::Table::BootstrapTableRenderer ::xo::Table::BootstrapTableRenderer ::xo::Table::BootstrapTableRenderer->::xo::Table::TABLE3 ::xo::Table::TABLE2 ::xo::Table::TABLE2 ::xo::Table::TABLE3->::xo::Table::TABLE2 ::xo::Table::TABLE ::xo::Table::TABLE ::xo::Table::TABLE2->::xo::Table::TABLE

Class ::xo::Table::YUIDataTableRenderer

::xo::Table::YUIDataTableRenderer[i] create ...

Defined in

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xo::Table::TABLE3[i]
::xotcl::Class create ::xo::Table::YUIDataTableRenderer \
     -superclass ::xo::Table::TABLE3

Methods (to be applied on instances)

  • render_yui_js (scripted, private)

     <instance of xo::Table::YUIDataTableRenderer[i]> render_yui_js

    Generates the JavaScript fragment, that is put below and (progressively enhances) the HTML table.

    Testcases:
    No testcase defined.
    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 $js

Variables

::xo::Table::YUIDataTableRenderer set __default_metaclass ::xotcl::Class
::xo::Table::YUIDataTableRenderer set __default_superclass ::xotcl::Object