dojox/grid/enhanced/plugins/exporter/TableWriter.js

  • Provides:

    • dojox.grid.enhanced.plugins.exporter.TableWriter
  • Requires:

    • dojox.grid.enhanced.plugins.exporter._ExportWriter in common
  • dojox.grid.enhanced.plugins.exporter.TableWriter

    • type
      Function
    • chains:
      • dojox.grid.enhanced.plugins.exporter._ExportWriter: (prototype)
      • dojox.grid.enhanced.plugins.exporter._ExportWriter: (call)
    • summary
      The generated table only defines the col/rowspan, height and width of
      all the cells in the style attribute, no other attributes
      (like border, cellspacing, etc.) are used.
      Users can define these attributes in the writerArgs object, like:
      {table:"border='border'",thead:"cellspacing='3'"}
    • parameters:
      • writerArgs: (typeof object)
    • source: [view]
        this._viewTables = [];
        this._tableAttrs = writerArgs || {};
  • dojox.grid.enhanced.plugins.exporter.TableWriter._getTableAttrs

    • type
      Function
    • parameters:
      • tagName: (typeof string)
        An html tag name
    • source: [view]
        var attrs = this._tableAttrs[tagName] || '';
        //To ensure the attribute list starts with a space
        if(attrs && attrs[0] != ' '){
         attrs = ' ' + attrs;
        }
        return attrs; //String
    • summary
      Get html attribute string for the given kind of tag.
    • tags:
    • return_summary
      The well formatted attributes for the given html table.tag
    • returns
      String
  • dojox.grid.enhanced.plugins.exporter.TableWriter._getRowClass

    • type
      Function
    • parameters:
      • arg_obj: (typeof object)
    • source: [view]
        return arg_obj.isHeader ? " grid_header"//String
          : [" grid_row grid_row_", arg_obj.rowIdx + 1,
          arg_obj.rowIdx % 2 ? " grid_even_row" : " grid_odd_row"].join('');
    • summary
      Get CSS class string for a row
    • tags:
    • returns
      String
  • dojox.grid.enhanced.plugins.exporter.TableWriter._getColumnClass

    • type
      Function
    • parameters:
      • arg_obj: (typeof object)
    • source: [view]
        var col_idx = arg_obj.cell.index + arg_obj.colOffset + 1;
        return [" grid_column_", col_idx,//String
          col_idx % 2 ? " grid_odd_column" : " grid_even_column"].join('');
    • summary
      Get CSS class string for a column
    • tags:
    • returns
      String
  • dojox.grid.enhanced.plugins.exporter.TableWriter.beforeView

    • type
      Function
    • parameters:
      • arg_obj: (typeof object)
    • source: [view]
        var viewIdx = arg_obj.viewIdx,
         table = this._viewTables[viewIdx],
         tagName, height,
         width = dojo.marginBox(arg_obj.view.contentNode).w;
        if(!table){
         var left = 0;
         for(var i = 0; i < viewIdx; ++i){
          left += this._viewTables[i]._width;
         }
         table = this._viewTables[viewIdx] = [''];
        }
        table._width = width;
        if(arg_obj.isHeader){
         tagName = 'thead';
         height = dojo.contentBox(arg_obj.view.headerContentNode).h;
        }else{
         tagName = 'tbody';
         var rowNode = arg_obj.grid.getRowNode(arg_obj.rowIdx);
         if(rowNode){
          height = dojo.contentBox(rowNode).h;
         }else{
          //This row has not been loaded from store, so we should estimate it's height.
          height = arg_obj.grid.scroller.averageRowHeight;
         }
        }
        table.push('<',tagName,
           ' style="height:', height, 'px; width:', width, 'px;"',
           ' class="', this._getRowClass(arg_obj), '"',
           this._getTableAttrs(tagName), '>');
        return true; //Boolean
    • summary
      Overrided from _ExportWriter
    • returns
      Boolean
    • dojox.grid.enhanced.plugins.exporter.TableWriter.afterView

      • type
        Function
      • parameters:
        • arg_obj: (typeof object)
      • source: [view]
          this._viewTables[arg_obj.viewIdx].push(arg_obj.isHeader ? '' : '');
      • summary
        Overrided from _ExportWriter
    • dojox.grid.enhanced.plugins.exporter.TableWriter.beforeSubrow

      • type
        Function
      • parameters:
        • arg_obj: (typeof object)
      • source: [view]
          this._viewTables[arg_obj.viewIdx].push('');
          return true; //Boolean
      • summary
        Overrided from _ExportWriter
      • returns
        Boolean
    • dojox.grid.enhanced.plugins.exporter.TableWriter.afterSubrow

      • type
        Function
      • parameters:
        • arg_obj: (typeof object)
      • source: [view]
          this._viewTables[arg_obj.viewIdx].push('');
      • summary
        Overrided from _ExportWriter
    • dojox.grid.enhanced.plugins.exporter.TableWriter.handleCell

      • type
        Function
      • parameters:
        • arg_obj: (typeof object)
      • source: [view]
          var cell = arg_obj.cell;
          if(cell.hidden || dojo.indexOf(arg_obj.spCols, cell.index) >= 0){
           //We are not interested in indirect selectors and row indexes.
           return;
          }
          var cellTagName = arg_obj.isHeader ? 'th' : 'td',
           attrs = [cell.colSpan ? ' colspan="' + cell.colSpan + '"' : '',
             cell.rowSpan ? ' rowspan="' + cell.rowSpan + '"' : '',
             ' style="width: ', dojo.contentBox(cell.getHeaderNode()).w, 'px;"',
             this._getTableAttrs(cellTagName),
             ' class="', this._getColumnClass(arg_obj), '"'].join(''),
           table = this._viewTables[arg_obj.viewIdx];
          table.push('<', cellTagName, attrs, '>');
          if(arg_obj.isHeader){
           table.push(cell.name || cell.field);
          } else{
           table.push(this._getExportDataForCell(arg_obj.rowIdx, arg_obj.row, cell, arg_obj.grid));
          }
          table.push('');
      • summary
        Overrided from _ExportWriter
    • dojox.grid.enhanced.plugins.exporter.TableWriter.afterContent

      • type
        Function
      • source: [view]
          dojo.forEach(this._viewTables, function(table){
           table.push('
    • ');
        });
    • summary
      Overrided from _ExportWriter
  • dojox.grid.enhanced.plugins.exporter.TableWriter.toString

    • type
      Function
    • source: [view]
        var viewsHTML = dojo.map(this._viewTables, function(table){ //String
         return table.join('');
        }).join('');
        return ['
      ', viewsHTML, '
      '].join('');
    • summary
      Overrided from _ExportWriter
  • dojox.grid.enhanced.plugins.exporter.TableWriter._viewTables

    • summary
  • dojox.grid.enhanced.plugins.exporter.TableWriter._tableAttrs

    • summary
  • dojox.grid.enhanced.plugins.exporter

    • type
      Object
    • summary
  • dojox.grid.enhanced.plugins

    • type
      Object
    • summary
  • dojox.grid.enhanced

    • type
      Object
    • summary
  • dojox.grid

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary