define("dojox/grid/enhanced/plugins/exporter/TableWriter", [ "dojo/_base/declare", "dojo/_base/array", "dojo/dom-geometry", "./_ExportWriter", "../Exporter" ], function(declare, array, domGeometry, _ExportWriter, Exporter){ Exporter.registerWriter("table", "dojox.grid.enhanced.plugins.exporter.TableWriter"); return declare("dojox.grid.enhanced.plugins.exporter.TableWriter", _ExportWriter, { // summary: // Export grid to HTML table format. Primarily used by Printer plugin. constructor: function(/* object? */writerArgs){ // 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'"} this._viewTables = []; this._tableAttrs = writerArgs || {}; }, _getTableAttrs: function(/* string */tagName){ // summary: // Get html attribute string for the given kind of tag. // tags: // private // tagName: string // An html tag name // returns: // The well formatted attributes for the given html table.tag var attrs = this._tableAttrs[tagName] || ''; //To ensure the attribute list starts with a space if(attrs && attrs[0] != ' '){ attrs = ' ' + attrs; } return attrs; //String }, _getRowClass: function(/* object */arg_obj){ // summary: // Get CSS class string for a row // tags: // private 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(''); }, _getColumnClass: function(/* object */arg_obj){ // summary: // Get CSS class string for a column // tags: // private var col_idx = arg_obj.cell.index + arg_obj.colOffset + 1; return [" grid_column grid_column_", col_idx,//String col_idx % 2 ? " grid_odd_column" : " grid_even_column"].join(''); }, beforeView: function(/* object */arg_obj){ // summary: // Overrided from _ExportWriter var viewIdx = arg_obj.viewIdx, table = this._viewTables[viewIdx], height, width = domGeometry.getMarginBox(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] = ['