a:181:{s:9:"#provides";s:16:"dojox.grid._Grid";s:9:"#resource";s:13:"grid/_Grid.js";s:9:"#requires";a:14:{i:0;a:3:{i:0;s:6:"common";i:1;s:11:"dijit.dijit";i:2;s:5:"dijit";}i:1;a:3:{i:0;s:6:"common";i:1;s:10:"dijit.Menu";i:2;s:5:"dijit";}i:2;a:2:{i:0;s:6:"common";i:1;s:18:"dojox.html.metrics";}i:3;a:2:{i:0;s:6:"common";i:1;s:15:"dojox.grid.util";}i:4;a:2:{i:0;s:6:"common";i:1;s:20:"dojox.grid._Scroller";}i:5;a:2:{i:0;s:6:"common";i:1;s:18:"dojox.grid._Layout";}i:6;a:2:{i:0;s:6:"common";i:1;s:16:"dojox.grid._View";}i:7;a:2:{i:0;s:6:"common";i:1;s:23:"dojox.grid._ViewManager";}i:8;a:2:{i:0;s:6:"common";i:1;s:22:"dojox.grid._RowManager";}i:9;a:2:{i:0;s:6:"common";i:1;s:24:"dojox.grid._FocusManager";}i:10;a:2:{i:0;s:6:"common";i:1;s:23:"dojox.grid._EditManager";}i:11;a:2:{i:0;s:6:"common";i:1;s:20:"dojox.grid.Selection";}i:12;a:2:{i:0;s:6:"common";i:1;s:23:"dojox.grid._RowSelector";}i:13;a:2:{i:0;s:6:"common";i:1;s:18:"dojox.grid._Events";}}s:16:"dojox.grid._Grid";a:7:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:13:"dijit._Widget";}s:4:"call";a:3:{i:0;s:13:"dijit._Widget";i:1;s:16:"dijit._Templated";i:2;s:18:"dojox.grid._Events";}}s:6:"mixins";a:1:{s:9:"prototype";a:2:{i:0;s:26:"dijit._Templated.prototype";i:1;s:28:"dojox.grid._Events.prototype";}}s:7:"summary";s:112:"A grid widget with virtual scrolling, cell editing, complex rows, sorting, fixed columns, sizeable columns, etc.";s:11:"description";s:290:"_Grid provides the full set of grid features without any direct connection to a data store. The grid exposes a get function for the grid, or optionally individual columns, to populate cell contents. The grid is rendered based on its structure, an object describing column and cell layout.";s:8:"examples";a:1:{i:0;s:476:"A quick sample: define a get function function get(inRowIndex){ // called in cell context return [this.index, inRowIndex].join(', '); } define the grid structure: var structure = [ // array of view objects { cells: [// array of rows, a row is an array of cells [ { name: "Alpha", width: 6 }, { name: "Beta" }, { name: "Gamma", get: get }] ]} ];
";}s:9:"classlike";b:1;}s:29:"dojox.grid._Grid.templatePath";a:2:{s:9:"prototype";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:25:"dojox.grid._Grid.classTag";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:6:"String";s:7:"summary";s:39:"CSS class applied to the grid's domNode";}s:20:"dojox.grid._Grid.get";a:8:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inRowIndex";a:2:{s:4:"type";s:7:"Integer";s:7:"summary";s:29:"Row for which to provide data";}}s:6:"source";s:302:" // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell.";s:7:"summary";s:20:"Default data getter.";s:11:"description";s:109:"Provides data to display in a grid cell. Called in grid cell context. So this.cell.index is the column index.";s:14:"return_summary";s:38:"Data to display for a given grid cell.";s:8:"instance";s:16:"dojox.grid._Grid";}s:25:"dojox.grid._Grid.rowCount";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:7:"Integer";s:7:"summary";s:26:"Number of rows to display.";}s:25:"dojox.grid._Grid.keepRows";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:7:"Integer";s:7:"summary";s:46:"Number of rows to keep in the rendering cache.";}s:28:"dojox.grid._Grid.rowsPerPage";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:7:"Integer";s:7:"summary";s:35:"Number of rows to render at a time.";}s:26:"dojox.grid._Grid.autoWidth";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:7:"Boolean";s:7:"summary";s:70:"If autoWidth is true, grid width is automatically set to fit the data.";}s:27:"dojox.grid._Grid.autoHeight";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:15:"Boolean|Integer";s:7:"summary";s:255:"If autoHeight is true, grid height is automatically set to fit the data. If it is an integer, the height will be automatically set to fit the data if there are fewer than that many rows - and the height will be set to show that many rows if there are more";}s:27:"dojox.grid._Grid.autoRender";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:7:"Boolean";s:7:"summary";s:68:"If autoRender is true, grid will render itself after initialization.";}s:30:"dojox.grid._Grid.defaultHeight";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:6:"String";s:7:"summary";s:59:"default height of the grid, measured in any valid css unit.";}s:23:"dojox.grid._Grid.height";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:6:"String";s:7:"summary";s:157:"explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) if the height: css attribute exists on the source node.";}s:26:"dojox.grid._Grid.structure";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:95:"dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]";s:7:"summary";s:22:"View layout defintion.";}s:28:"dojox.grid._Grid.elasticView";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:7:"Integer";s:7:"summary";s:98:"Override defaults and make the indexed grid view elastic, thus filling available horizontal space.";}s:32:"dojox.grid._Grid.singleClickEdit";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:7:"boolean";s:7:"summary";s:52:"Single-click starts editing. Default is double-click";}s:30:"dojox.grid._Grid.selectionMode";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:6:"String";s:7:"summary";s:119:"Set the selection mode of grid's Selection. Value must be 'single', 'multiple', or 'extended'. Default is 'extended'.";}s:28:"dojox.grid._Grid.rowSelector";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:14:"Boolean|String";s:7:"summary";s:134:"If set to true, will add a row selector view to this grid. If set to a CSS width, will add a row selector of that width to this grid.";}s:33:"dojox.grid._Grid.columnReordering";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:7:"Boolean";s:7:"summary";s:83:"If set to true, will add drag and drop reordering to views with one row of columns.";}s:27:"dojox.grid._Grid.headerMenu";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:10:"dijit.Menu";s:7:"summary";s:77:"If set to a dijit.Menu, will use this as a context menu for the grid headers.";}s:33:"dojox.grid._Grid.placeholderLabel";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:6:"String";s:7:"summary";s:98:"Label of placeholders to search for in the header menu to replace with column toggling menu items.";}s:27:"dojox.grid._Grid.selectable";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:7:"Boolean";s:7:"summary";s:166:"Set to true if you want to be able to select the text within the grid. Used to store the last two clicks, to ensure double-clicking occurs based on the intended row";}s:23:"dojox.grid._Grid._click";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:7:"private";b:1;s:7:"summary";s:0:"";}s:31:"dojox.grid._Grid.loadingMessage";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:6:"String";s:7:"summary";s:44:"Message that shows while the grid is loading";}s:29:"dojox.grid._Grid.errorMessage";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:6:"String";s:7:"summary";s:60:"Message that shows when the grid encounters an error loading";}s:30:"dojox.grid._Grid.noDataMessage";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:6:"String";s:7:"summary";s:161:"Message that shows if the grid has no data - wrap it in a span with class 'dojoxGridNoData' if you want it to be styled similar to the loading and error messages";}s:25:"dojox.grid._Grid.sortInfo";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:26:"dojox.grid._Grid.themeable";a:2:{s:9:"prototype";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:30:"dojox.grid._Grid._placeholders";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:7:"private";b:1;s:7:"summary";s:0:"";}s:31:"dojox.grid._Grid.buildRendering";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:862:" this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle");";s:7:"summary";s:0:"";}s:36:"dojox.grid._Grid.postMixInProperties";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:475:" this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true);";s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.postCreate";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:12480:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = [];";s:7:"summary";s:0:"";}s:24:"dojox.grid._Grid.destroy";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:572:" this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments);";s:7:"summary";s:0:"";}s:35:"dojox.grid._Grid._setAutoHeightAttr";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:2:"ah";a:1:{s:4:"type";s:0:"";}s:10:"skipRender";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:14050:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); }";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.grid._Grid._getRowCountAttr";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:134:" return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount;";s:7:"private";b:1;s:7:"summary";s:0:"";}s:29:"dojox.grid._Grid.styleChanged";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:41:" this.setStyledClass(this.domNode, '');";s:7:"summary";s:0:"";}s:30:"dojox.grid._Grid._styleChanged";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:41:" this.styleChanged(); this.update();";s:7:"private";b:1;s:7:"summary";s:0:"";}s:32:"dojox.grid._Grid.textSizeChanged";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:55:" setTimeout(dojo.hitch(this, "_textSizeChanged"), 1);";s:7:"summary";s:0:"";}s:33:"dojox.grid._Grid._textSizeChanged";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:113:" if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); }";s:7:"private";b:1;s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.sizeChange";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:68:" jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update"));";s:7:"summary";s:0:"";}s:29:"dojox.grid._Grid.renderOnIdle";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:45:" setTimeout(dojo.hitch(this, "render"), 1);";s:7:"summary";s:0:"";}s:31:"dojox.grid._Grid.createManagers";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:15162:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); } }, _getRowCountAttr: function(){ return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount; }, styleChanged: function(){ this.setStyledClass(this.domNode, ''); }, _styleChanged: function(){ this.styleChanged(); this.update(); }, textSizeChanged: function(){ setTimeout(dojo.hitch(this, "_textSizeChanged"), 1); }, _textSizeChanged: function(){ if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); } }, sizeChange: function(){ jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update")); }, renderOnIdle: function() { setTimeout(dojo.hitch(this, "render"), 1); }, createManagers: function(){ // summary: // create grid managers for various tasks including rows, focus, selection, editing // row manager this.rows = new dojox.grid._RowManager(this); // focus manager this.focus = new dojox.grid._FocusManager(this); // edit manager this.edit = new dojox.grid._EditManager(this);";s:7:"summary";s:0:"";}s:32:"dojox.grid._Grid.createSelection";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:15331:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); } }, _getRowCountAttr: function(){ return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount; }, styleChanged: function(){ this.setStyledClass(this.domNode, ''); }, _styleChanged: function(){ this.styleChanged(); this.update(); }, textSizeChanged: function(){ setTimeout(dojo.hitch(this, "_textSizeChanged"), 1); }, _textSizeChanged: function(){ if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); } }, sizeChange: function(){ jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update")); }, renderOnIdle: function() { setTimeout(dojo.hitch(this, "render"), 1); }, createManagers: function(){ // summary: // create grid managers for various tasks including rows, focus, selection, editing // row manager this.rows = new dojox.grid._RowManager(this); // focus manager this.focus = new dojox.grid._FocusManager(this); // edit manager this.edit = new dojox.grid._EditManager(this); }, createSelection: function(){ // summary: Creates a new Grid selection manager. // selection manager this.selection = new dojox.grid.Selection(this);";s:7:"summary";s:0:"";}s:31:"dojox.grid._Grid.createScroller";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:245:" this.scroller = new dojox.grid._Scroller(); this.scroller.grid = this; this.scroller._pageIdPrefix = this.id + '-'; this.scroller.renderRow = dojo.hitch(this, "renderRow"); this.scroller.removeRow = dojo.hitch(this, "rowRemoved");";s:7:"summary";s:30:"Creates a new virtual scroller";}s:29:"dojox.grid._Grid.createLayout";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:106:" this.layout = new dojox.grid._Layout(this); this.connect(this.layout, "moveColumn", "onMoveColumn");";s:7:"summary";s:25:"Creates a new Grid layout";}s:29:"dojox.grid._Grid.onMoveColumn";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:36:" this.render(); this._resize();";s:7:"summary";s:0:"";}s:28:"dojox.grid._Grid.createViews";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:109:" this.views = new dojox.grid._ViewManager(this); this.views.createView = dojo.hitch(this, "createView");";s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.createView";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:7:"inClass";a:1:{s:4:"type";s:0:"";}s:3:"idx";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:228:" var c = dojo.getObject(inClass); var view = new c({ grid: this, index: idx }); this.viewsNode.appendChild(view.domNode); this.viewsHeaderNode.appendChild(view.headerNode); this.views.addView(view); return view;";s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.buildViews";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:211:" for(var i=0, vs; (vs=this.layout.structure[i]); i++){ this.createView(vs.type || dojox._scopeName + ".grid._View", i).setStructure(vs); } this.scroller.setContentNodes(this.views.getContentNodes());";s:7:"summary";s:0:"";}s:34:"dojox.grid._Grid._setStructureAttr";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"structure";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:480:" var s = structure; if(s && dojo.isString(s)){ dojo.deprecated("dojox.grid._Grid.attr('structure', 'objVar')", "use dojox.grid._Grid.attr('structure', objVar) instead", "2.0"); s=dojo.getObject(s); } this.structure = s; if(!s){ if(this.layout.structure){ s = this.layout.structure; }else{ return; } } this.views.destroyViews(); if(s !== this.layout.structure){ this.layout.setStructure(s); } this._structureChanged();";s:7:"private";b:1;s:7:"summary";s:0:"";}s:29:"dojox.grid._Grid.setStructure";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:11:"inStructure";a:1:{s:4:"type";s:96:"dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]";}}s:6:"source";s:160:" dojo.deprecated("dojox.grid._Grid.setStructure(obj)", "use dojox.grid._Grid.attr('structure', obj) instead.", "2.0"); this._setStructureAttr(inStructure);";s:7:"summary";s:45:"Install a new structure and rebuild the grid.";}s:39:"dojox.grid._Grid.getColumnTogglingItems";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:19014:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); } }, _getRowCountAttr: function(){ return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount; }, styleChanged: function(){ this.setStyledClass(this.domNode, ''); }, _styleChanged: function(){ this.styleChanged(); this.update(); }, textSizeChanged: function(){ setTimeout(dojo.hitch(this, "_textSizeChanged"), 1); }, _textSizeChanged: function(){ if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); } }, sizeChange: function(){ jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update")); }, renderOnIdle: function() { setTimeout(dojo.hitch(this, "render"), 1); }, createManagers: function(){ // summary: // create grid managers for various tasks including rows, focus, selection, editing // row manager this.rows = new dojox.grid._RowManager(this); // focus manager this.focus = new dojox.grid._FocusManager(this); // edit manager this.edit = new dojox.grid._EditManager(this); }, createSelection: function(){ // summary: Creates a new Grid selection manager. // selection manager this.selection = new dojox.grid.Selection(this); }, createScroller: function(){ // summary: Creates a new virtual scroller this.scroller = new dojox.grid._Scroller(); this.scroller.grid = this; this.scroller._pageIdPrefix = this.id + '-'; this.scroller.renderRow = dojo.hitch(this, "renderRow"); this.scroller.removeRow = dojo.hitch(this, "rowRemoved"); }, createLayout: function(){ // summary: Creates a new Grid layout this.layout = new dojox.grid._Layout(this); this.connect(this.layout, "moveColumn", "onMoveColumn"); }, onMoveColumn: function(){ this.render(); this._resize(); }, // views createViews: function(){ this.views = new dojox.grid._ViewManager(this); this.views.createView = dojo.hitch(this, "createView"); }, createView: function(inClass, idx){ var c = dojo.getObject(inClass); var view = new c({ grid: this, index: idx }); this.viewsNode.appendChild(view.domNode); this.viewsHeaderNode.appendChild(view.headerNode); this.views.addView(view); return view; }, buildViews: function(){ for(var i=0, vs; (vs=this.layout.structure[i]); i++){ this.createView(vs.type || dojox._scopeName + ".grid._View", i).setStructure(vs); } this.scroller.setContentNodes(this.views.getContentNodes()); }, _setStructureAttr: function(structure){ var s = structure; if(s && dojo.isString(s)){ dojo.deprecated("dojox.grid._Grid.attr('structure', 'objVar')", "use dojox.grid._Grid.attr('structure', objVar) instead", "2.0"); s=dojo.getObject(s); } this.structure = s; if(!s){ if(this.layout.structure){ s = this.layout.structure; }else{ return; } } this.views.destroyViews(); if(s !== this.layout.structure){ this.layout.setStructure(s); } this._structureChanged(); }, setStructure: function(/* dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] */ inStructure){ // summary: // Install a new structure and rebuild the grid. dojo.deprecated("dojox.grid._Grid.setStructure(obj)", "use dojox.grid._Grid.attr('structure', obj) instead.", "2.0"); this._setStructureAttr(inStructure); }, getColumnTogglingItems: function(){ // Summary: returns an array of dijit.CheckedMenuItem widgets that can be // added to a menu for toggling columns on and off. return dojo.map(this.layout.cells, function(cell){ if(!cell.menuItems){ cell.menuItems = []; } var self = this; var item = new dijit.CheckedMenuItem({ label: cell.name, checked: !cell.hidden, _gridCell: cell, onChange: function(checked){ if(self.layout.setColumnVisibility(this._gridCell.index, checked)){ var items = this._gridCell.menuItems; if(items.length > 1){ dojo.forEach(items, function(item){ if(item !== this){ item.setAttribute("checked", checked); } }, this); } var checked = dojo.filter(self.layout.cells, function(c){ if(c.menuItems.length > 1){ dojo.forEach(c.menuItems, "item.attr('disabled', false);"); }else{ c.menuItems[0].attr('disabled', false); } return !c.hidden; }); if(checked.length == 1){ dojo.forEach(checked[0].menuItems, "item.attr('disabled', true);"); } } }, destroy: function(){ var index = dojo.indexOf(this._gridCell.menuItems, this); this._gridCell.menuItems.splice(index, 1); delete this._gridCell; dijit.CheckedMenuItem.prototype.destroy.apply(this, arguments); } }); cell.menuItems.push(item); return item; }, this); // dijit.CheckedMenuItem[]";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:39:"dijit.CheckedMenuItem.prototype.destroy";}}s:7:"summary";s:0:"";}s:35:"dojox.grid._Grid._setHeaderMenuAttr";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"menu";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:490:" if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this._placeholders = []; } if(this.headerMenu){ this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.headerMenu = menu; if(!menu){ return; } this.headerMenu.bindDomNode(this.viewsHeaderNode); if(this.headerMenu.getPlaceholders){ this._placeholders = this.headerMenu.getPlaceholders(this.placeholderLabel); }";s:7:"private";b:1;s:7:"summary";s:0:"";}s:30:"dojox.grid._Grid.setHeaderMenu";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"menu";a:1:{s:4:"type";s:10:"dijit.Menu";}}s:6:"source";s:156:" dojo.deprecated("dojox.grid._Grid.setHeaderMenu(obj)", "use dojox.grid._Grid.attr('headerMenu', obj) instead.", "2.0"); this._setHeaderMenuAttr(menu);";s:7:"summary";s:0:"";}s:32:"dojox.grid._Grid.setupHeaderMenu";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:225:" if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ if(p._replaced){ p.unReplace(true); } p.replace(this.getColumnTogglingItems()); }, this); }";s:7:"summary";s:0:"";}s:23:"dojox.grid._Grid._fetch";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"start";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:24:" this.setScrollTop(0);";s:7:"private";b:1;s:7:"summary";s:0:"";}s:24:"dojox.grid._Grid.getItem";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inRowIndex";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:15:" return null;";s:7:"summary";s:0:"";}s:28:"dojox.grid._Grid.showMessage";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"message";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:199:" if(message){ this.messagesNode.innerHTML = message; this.messagesNode.style.display = ""; }else{ this.messagesNode.innerHTML = ""; this.messagesNode.style.display = "none"; }";s:7:"summary";s:0:"";}s:34:"dojox.grid._Grid._structureChanged";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:86:" this.buildViews(); if(this.autoRender && this._started){ this.render(); }";s:7:"private";b:1;s:7:"summary";s:0:"";}s:26:"dojox.grid._Grid.hasLayout";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:35:" return this.layout.cells.length;";s:7:"summary";s:0:"";}s:23:"dojox.grid._Grid.resize";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:10:"changeSize";a:1:{s:4:"type";s:0:"";}s:10:"resultSize";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:62:" this._resize(changeSize, resultSize); this.sizeChange();";s:7:"summary";s:52:"Update the grid's rendering dimensions and resize it";}s:30:"dojox.grid._Grid._getPadBorder";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:107:" this._padBorder = this._padBorder || dojo._getPadBorderExtents(this.domNode); return this._padBorder;";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.grid._Grid._getHeaderHeight";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:269:" var vns = this.viewsHeaderNode.style, t = vns.display == "none" ? 0 : this.views.measureHeader(); vns.height = t + 'px'; // header heights are reset during measuring so must be normalized after measuring. this.views.normalizeHeaderNodeHeight(); return t;";s:7:"private";b:1;s:7:"summary";s:0:"";}s:24:"dojox.grid._Grid._resize";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:10:"changeSize";a:1:{s:4:"type";s:0:"";}s:10:"resultSize";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:23407:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); } }, _getRowCountAttr: function(){ return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount; }, styleChanged: function(){ this.setStyledClass(this.domNode, ''); }, _styleChanged: function(){ this.styleChanged(); this.update(); }, textSizeChanged: function(){ setTimeout(dojo.hitch(this, "_textSizeChanged"), 1); }, _textSizeChanged: function(){ if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); } }, sizeChange: function(){ jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update")); }, renderOnIdle: function() { setTimeout(dojo.hitch(this, "render"), 1); }, createManagers: function(){ // summary: // create grid managers for various tasks including rows, focus, selection, editing // row manager this.rows = new dojox.grid._RowManager(this); // focus manager this.focus = new dojox.grid._FocusManager(this); // edit manager this.edit = new dojox.grid._EditManager(this); }, createSelection: function(){ // summary: Creates a new Grid selection manager. // selection manager this.selection = new dojox.grid.Selection(this); }, createScroller: function(){ // summary: Creates a new virtual scroller this.scroller = new dojox.grid._Scroller(); this.scroller.grid = this; this.scroller._pageIdPrefix = this.id + '-'; this.scroller.renderRow = dojo.hitch(this, "renderRow"); this.scroller.removeRow = dojo.hitch(this, "rowRemoved"); }, createLayout: function(){ // summary: Creates a new Grid layout this.layout = new dojox.grid._Layout(this); this.connect(this.layout, "moveColumn", "onMoveColumn"); }, onMoveColumn: function(){ this.render(); this._resize(); }, // views createViews: function(){ this.views = new dojox.grid._ViewManager(this); this.views.createView = dojo.hitch(this, "createView"); }, createView: function(inClass, idx){ var c = dojo.getObject(inClass); var view = new c({ grid: this, index: idx }); this.viewsNode.appendChild(view.domNode); this.viewsHeaderNode.appendChild(view.headerNode); this.views.addView(view); return view; }, buildViews: function(){ for(var i=0, vs; (vs=this.layout.structure[i]); i++){ this.createView(vs.type || dojox._scopeName + ".grid._View", i).setStructure(vs); } this.scroller.setContentNodes(this.views.getContentNodes()); }, _setStructureAttr: function(structure){ var s = structure; if(s && dojo.isString(s)){ dojo.deprecated("dojox.grid._Grid.attr('structure', 'objVar')", "use dojox.grid._Grid.attr('structure', objVar) instead", "2.0"); s=dojo.getObject(s); } this.structure = s; if(!s){ if(this.layout.structure){ s = this.layout.structure; }else{ return; } } this.views.destroyViews(); if(s !== this.layout.structure){ this.layout.setStructure(s); } this._structureChanged(); }, setStructure: function(/* dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] */ inStructure){ // summary: // Install a new structure and rebuild the grid. dojo.deprecated("dojox.grid._Grid.setStructure(obj)", "use dojox.grid._Grid.attr('structure', obj) instead.", "2.0"); this._setStructureAttr(inStructure); }, getColumnTogglingItems: function(){ // Summary: returns an array of dijit.CheckedMenuItem widgets that can be // added to a menu for toggling columns on and off. return dojo.map(this.layout.cells, function(cell){ if(!cell.menuItems){ cell.menuItems = []; } var self = this; var item = new dijit.CheckedMenuItem({ label: cell.name, checked: !cell.hidden, _gridCell: cell, onChange: function(checked){ if(self.layout.setColumnVisibility(this._gridCell.index, checked)){ var items = this._gridCell.menuItems; if(items.length > 1){ dojo.forEach(items, function(item){ if(item !== this){ item.setAttribute("checked", checked); } }, this); } var checked = dojo.filter(self.layout.cells, function(c){ if(c.menuItems.length > 1){ dojo.forEach(c.menuItems, "item.attr('disabled', false);"); }else{ c.menuItems[0].attr('disabled', false); } return !c.hidden; }); if(checked.length == 1){ dojo.forEach(checked[0].menuItems, "item.attr('disabled', true);"); } } }, destroy: function(){ var index = dojo.indexOf(this._gridCell.menuItems, this); this._gridCell.menuItems.splice(index, 1); delete this._gridCell; dijit.CheckedMenuItem.prototype.destroy.apply(this, arguments); } }); cell.menuItems.push(item); return item; }, this); // dijit.CheckedMenuItem[] }, _setHeaderMenuAttr: function(menu){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this._placeholders = []; } if(this.headerMenu){ this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.headerMenu = menu; if(!menu){ return; } this.headerMenu.bindDomNode(this.viewsHeaderNode); if(this.headerMenu.getPlaceholders){ this._placeholders = this.headerMenu.getPlaceholders(this.placeholderLabel); } }, setHeaderMenu: function(/* dijit.Menu */ menu){ dojo.deprecated("dojox.grid._Grid.setHeaderMenu(obj)", "use dojox.grid._Grid.attr('headerMenu', obj) instead.", "2.0"); this._setHeaderMenuAttr(menu); }, setupHeaderMenu: function(){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ if(p._replaced){ p.unReplace(true); } p.replace(this.getColumnTogglingItems()); }, this); } }, _fetch: function(start){ this.setScrollTop(0); }, getItem: function(inRowIndex){ return null; }, showMessage: function(message){ if(message){ this.messagesNode.innerHTML = message; this.messagesNode.style.display = ""; }else{ this.messagesNode.innerHTML = ""; this.messagesNode.style.display = "none"; } }, _structureChanged: function() { this.buildViews(); if(this.autoRender && this._started){ this.render(); } }, hasLayout: function() { return this.layout.cells.length; }, // sizing resize: function(changeSize, resultSize){ // summary: // Update the grid's rendering dimensions and resize it this._resize(changeSize, resultSize); this.sizeChange(); }, _getPadBorder: function() { this._padBorder = this._padBorder || dojo._getPadBorderExtents(this.domNode); return this._padBorder; }, _getHeaderHeight: function(){ var vns = this.viewsHeaderNode.style, t = vns.display == "none" ? 0 : this.views.measureHeader(); vns.height = t + 'px'; // header heights are reset during measuring so must be normalized after measuring. this.views.normalizeHeaderNodeHeight(); return t; }, _resize: function(changeSize, resultSize){ // if we have set up everything except the DOM, we cannot resize var pn = this.domNode.parentNode; if(!pn || pn.nodeType != 1 || !this.hasLayout() || pn.style.visibility == "hidden" || pn.style.display == "none"){ return; } // useful measurement var padBorder = this._getPadBorder(); var hh = 0; // grid height if(this._autoHeight){ this.domNode.style.height = 'auto'; this.viewsNode.style.height = ''; }else if(typeof this.autoHeight == "number"){ var h = hh = this._getHeaderHeight(); h += (this.scroller.averageRowHeight * this.autoHeight); this.domNode.style.height = h + "px"; }else if(this.flex > 0){ }else if(this.domNode.clientHeight <= padBorder.h){ if(pn == document.body){ this.domNode.style.height = this.defaultHeight; }else if(this.height){ this.domNode.style.height = this.height; }else{ this.fitTo = "parent"; } } // if we are given dimensions, size the grid's domNode to those dimensions if(resultSize){ changeSize = resultSize; } if(changeSize){ dojo.marginBox(this.domNode, changeSize); this.height = this.domNode.style.height; delete this.fitTo; }else if(this.fitTo == "parent"){ var h = dojo._getContentBox(pn).h; dojo.marginBox(this.domNode, { h: Math.max(0, h) }); } var h = dojo._getContentBox(this.domNode).h; if(h == 0 && !this._autoHeight){ // We need to hide the header, since the Grid is essentially hidden. this.viewsHeaderNode.style.display = "none"; }else{ // Otherwise, show the header and give it an appropriate height. this.viewsHeaderNode.style.display = "block"; hh = this._getHeaderHeight(); } // NOTE: it is essential that width be applied before height // Header height can only be calculated properly after view widths have been set. // This is because flex column width is naturally 0 in Firefox. // Therefore prior to width sizing flex columns with spaces are maximally wrapped // and calculated to be too tall. this.adaptWidth(); this.adaptHeight(hh); this.postresize();";s:7:"private";b:1;s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.adaptWidth";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:23774:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); } }, _getRowCountAttr: function(){ return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount; }, styleChanged: function(){ this.setStyledClass(this.domNode, ''); }, _styleChanged: function(){ this.styleChanged(); this.update(); }, textSizeChanged: function(){ setTimeout(dojo.hitch(this, "_textSizeChanged"), 1); }, _textSizeChanged: function(){ if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); } }, sizeChange: function(){ jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update")); }, renderOnIdle: function() { setTimeout(dojo.hitch(this, "render"), 1); }, createManagers: function(){ // summary: // create grid managers for various tasks including rows, focus, selection, editing // row manager this.rows = new dojox.grid._RowManager(this); // focus manager this.focus = new dojox.grid._FocusManager(this); // edit manager this.edit = new dojox.grid._EditManager(this); }, createSelection: function(){ // summary: Creates a new Grid selection manager. // selection manager this.selection = new dojox.grid.Selection(this); }, createScroller: function(){ // summary: Creates a new virtual scroller this.scroller = new dojox.grid._Scroller(); this.scroller.grid = this; this.scroller._pageIdPrefix = this.id + '-'; this.scroller.renderRow = dojo.hitch(this, "renderRow"); this.scroller.removeRow = dojo.hitch(this, "rowRemoved"); }, createLayout: function(){ // summary: Creates a new Grid layout this.layout = new dojox.grid._Layout(this); this.connect(this.layout, "moveColumn", "onMoveColumn"); }, onMoveColumn: function(){ this.render(); this._resize(); }, // views createViews: function(){ this.views = new dojox.grid._ViewManager(this); this.views.createView = dojo.hitch(this, "createView"); }, createView: function(inClass, idx){ var c = dojo.getObject(inClass); var view = new c({ grid: this, index: idx }); this.viewsNode.appendChild(view.domNode); this.viewsHeaderNode.appendChild(view.headerNode); this.views.addView(view); return view; }, buildViews: function(){ for(var i=0, vs; (vs=this.layout.structure[i]); i++){ this.createView(vs.type || dojox._scopeName + ".grid._View", i).setStructure(vs); } this.scroller.setContentNodes(this.views.getContentNodes()); }, _setStructureAttr: function(structure){ var s = structure; if(s && dojo.isString(s)){ dojo.deprecated("dojox.grid._Grid.attr('structure', 'objVar')", "use dojox.grid._Grid.attr('structure', objVar) instead", "2.0"); s=dojo.getObject(s); } this.structure = s; if(!s){ if(this.layout.structure){ s = this.layout.structure; }else{ return; } } this.views.destroyViews(); if(s !== this.layout.structure){ this.layout.setStructure(s); } this._structureChanged(); }, setStructure: function(/* dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] */ inStructure){ // summary: // Install a new structure and rebuild the grid. dojo.deprecated("dojox.grid._Grid.setStructure(obj)", "use dojox.grid._Grid.attr('structure', obj) instead.", "2.0"); this._setStructureAttr(inStructure); }, getColumnTogglingItems: function(){ // Summary: returns an array of dijit.CheckedMenuItem widgets that can be // added to a menu for toggling columns on and off. return dojo.map(this.layout.cells, function(cell){ if(!cell.menuItems){ cell.menuItems = []; } var self = this; var item = new dijit.CheckedMenuItem({ label: cell.name, checked: !cell.hidden, _gridCell: cell, onChange: function(checked){ if(self.layout.setColumnVisibility(this._gridCell.index, checked)){ var items = this._gridCell.menuItems; if(items.length > 1){ dojo.forEach(items, function(item){ if(item !== this){ item.setAttribute("checked", checked); } }, this); } var checked = dojo.filter(self.layout.cells, function(c){ if(c.menuItems.length > 1){ dojo.forEach(c.menuItems, "item.attr('disabled', false);"); }else{ c.menuItems[0].attr('disabled', false); } return !c.hidden; }); if(checked.length == 1){ dojo.forEach(checked[0].menuItems, "item.attr('disabled', true);"); } } }, destroy: function(){ var index = dojo.indexOf(this._gridCell.menuItems, this); this._gridCell.menuItems.splice(index, 1); delete this._gridCell; dijit.CheckedMenuItem.prototype.destroy.apply(this, arguments); } }); cell.menuItems.push(item); return item; }, this); // dijit.CheckedMenuItem[] }, _setHeaderMenuAttr: function(menu){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this._placeholders = []; } if(this.headerMenu){ this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.headerMenu = menu; if(!menu){ return; } this.headerMenu.bindDomNode(this.viewsHeaderNode); if(this.headerMenu.getPlaceholders){ this._placeholders = this.headerMenu.getPlaceholders(this.placeholderLabel); } }, setHeaderMenu: function(/* dijit.Menu */ menu){ dojo.deprecated("dojox.grid._Grid.setHeaderMenu(obj)", "use dojox.grid._Grid.attr('headerMenu', obj) instead.", "2.0"); this._setHeaderMenuAttr(menu); }, setupHeaderMenu: function(){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ if(p._replaced){ p.unReplace(true); } p.replace(this.getColumnTogglingItems()); }, this); } }, _fetch: function(start){ this.setScrollTop(0); }, getItem: function(inRowIndex){ return null; }, showMessage: function(message){ if(message){ this.messagesNode.innerHTML = message; this.messagesNode.style.display = ""; }else{ this.messagesNode.innerHTML = ""; this.messagesNode.style.display = "none"; } }, _structureChanged: function() { this.buildViews(); if(this.autoRender && this._started){ this.render(); } }, hasLayout: function() { return this.layout.cells.length; }, // sizing resize: function(changeSize, resultSize){ // summary: // Update the grid's rendering dimensions and resize it this._resize(changeSize, resultSize); this.sizeChange(); }, _getPadBorder: function() { this._padBorder = this._padBorder || dojo._getPadBorderExtents(this.domNode); return this._padBorder; }, _getHeaderHeight: function(){ var vns = this.viewsHeaderNode.style, t = vns.display == "none" ? 0 : this.views.measureHeader(); vns.height = t + 'px'; // header heights are reset during measuring so must be normalized after measuring. this.views.normalizeHeaderNodeHeight(); return t; }, _resize: function(changeSize, resultSize){ // if we have set up everything except the DOM, we cannot resize var pn = this.domNode.parentNode; if(!pn || pn.nodeType != 1 || !this.hasLayout() || pn.style.visibility == "hidden" || pn.style.display == "none"){ return; } // useful measurement var padBorder = this._getPadBorder(); var hh = 0; // grid height if(this._autoHeight){ this.domNode.style.height = 'auto'; this.viewsNode.style.height = ''; }else if(typeof this.autoHeight == "number"){ var h = hh = this._getHeaderHeight(); h += (this.scroller.averageRowHeight * this.autoHeight); this.domNode.style.height = h + "px"; }else if(this.flex > 0){ }else if(this.domNode.clientHeight <= padBorder.h){ if(pn == document.body){ this.domNode.style.height = this.defaultHeight; }else if(this.height){ this.domNode.style.height = this.height; }else{ this.fitTo = "parent"; } } // if we are given dimensions, size the grid's domNode to those dimensions if(resultSize){ changeSize = resultSize; } if(changeSize){ dojo.marginBox(this.domNode, changeSize); this.height = this.domNode.style.height; delete this.fitTo; }else if(this.fitTo == "parent"){ var h = dojo._getContentBox(pn).h; dojo.marginBox(this.domNode, { h: Math.max(0, h) }); } var h = dojo._getContentBox(this.domNode).h; if(h == 0 && !this._autoHeight){ // We need to hide the header, since the Grid is essentially hidden. this.viewsHeaderNode.style.display = "none"; }else{ // Otherwise, show the header and give it an appropriate height. this.viewsHeaderNode.style.display = "block"; hh = this._getHeaderHeight(); } // NOTE: it is essential that width be applied before height // Header height can only be calculated properly after view widths have been set. // This is because flex column width is naturally 0 in Firefox. // Therefore prior to width sizing flex columns with spaces are maximally wrapped // and calculated to be too tall. this.adaptWidth(); this.adaptHeight(hh); this.postresize(); }, adaptWidth: function() { // private: sets width and position for views and update grid width if necessary var w = this.autoWidth ? 0 : this.domNode.clientWidth || (this.domNode.offsetWidth - this._getPadBorder().w), vw = this.views.arrange(1, w); this.views.onEach("adaptWidth"); if (this.autoWidth) this.domNode.style.width = vw + "px";";s:7:"summary";s:0:"";}s:28:"dojox.grid._Grid.adaptHeight";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:14:"inHeaderHeight";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:24794:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); } }, _getRowCountAttr: function(){ return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount; }, styleChanged: function(){ this.setStyledClass(this.domNode, ''); }, _styleChanged: function(){ this.styleChanged(); this.update(); }, textSizeChanged: function(){ setTimeout(dojo.hitch(this, "_textSizeChanged"), 1); }, _textSizeChanged: function(){ if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); } }, sizeChange: function(){ jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update")); }, renderOnIdle: function() { setTimeout(dojo.hitch(this, "render"), 1); }, createManagers: function(){ // summary: // create grid managers for various tasks including rows, focus, selection, editing // row manager this.rows = new dojox.grid._RowManager(this); // focus manager this.focus = new dojox.grid._FocusManager(this); // edit manager this.edit = new dojox.grid._EditManager(this); }, createSelection: function(){ // summary: Creates a new Grid selection manager. // selection manager this.selection = new dojox.grid.Selection(this); }, createScroller: function(){ // summary: Creates a new virtual scroller this.scroller = new dojox.grid._Scroller(); this.scroller.grid = this; this.scroller._pageIdPrefix = this.id + '-'; this.scroller.renderRow = dojo.hitch(this, "renderRow"); this.scroller.removeRow = dojo.hitch(this, "rowRemoved"); }, createLayout: function(){ // summary: Creates a new Grid layout this.layout = new dojox.grid._Layout(this); this.connect(this.layout, "moveColumn", "onMoveColumn"); }, onMoveColumn: function(){ this.render(); this._resize(); }, // views createViews: function(){ this.views = new dojox.grid._ViewManager(this); this.views.createView = dojo.hitch(this, "createView"); }, createView: function(inClass, idx){ var c = dojo.getObject(inClass); var view = new c({ grid: this, index: idx }); this.viewsNode.appendChild(view.domNode); this.viewsHeaderNode.appendChild(view.headerNode); this.views.addView(view); return view; }, buildViews: function(){ for(var i=0, vs; (vs=this.layout.structure[i]); i++){ this.createView(vs.type || dojox._scopeName + ".grid._View", i).setStructure(vs); } this.scroller.setContentNodes(this.views.getContentNodes()); }, _setStructureAttr: function(structure){ var s = structure; if(s && dojo.isString(s)){ dojo.deprecated("dojox.grid._Grid.attr('structure', 'objVar')", "use dojox.grid._Grid.attr('structure', objVar) instead", "2.0"); s=dojo.getObject(s); } this.structure = s; if(!s){ if(this.layout.structure){ s = this.layout.structure; }else{ return; } } this.views.destroyViews(); if(s !== this.layout.structure){ this.layout.setStructure(s); } this._structureChanged(); }, setStructure: function(/* dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] */ inStructure){ // summary: // Install a new structure and rebuild the grid. dojo.deprecated("dojox.grid._Grid.setStructure(obj)", "use dojox.grid._Grid.attr('structure', obj) instead.", "2.0"); this._setStructureAttr(inStructure); }, getColumnTogglingItems: function(){ // Summary: returns an array of dijit.CheckedMenuItem widgets that can be // added to a menu for toggling columns on and off. return dojo.map(this.layout.cells, function(cell){ if(!cell.menuItems){ cell.menuItems = []; } var self = this; var item = new dijit.CheckedMenuItem({ label: cell.name, checked: !cell.hidden, _gridCell: cell, onChange: function(checked){ if(self.layout.setColumnVisibility(this._gridCell.index, checked)){ var items = this._gridCell.menuItems; if(items.length > 1){ dojo.forEach(items, function(item){ if(item !== this){ item.setAttribute("checked", checked); } }, this); } var checked = dojo.filter(self.layout.cells, function(c){ if(c.menuItems.length > 1){ dojo.forEach(c.menuItems, "item.attr('disabled', false);"); }else{ c.menuItems[0].attr('disabled', false); } return !c.hidden; }); if(checked.length == 1){ dojo.forEach(checked[0].menuItems, "item.attr('disabled', true);"); } } }, destroy: function(){ var index = dojo.indexOf(this._gridCell.menuItems, this); this._gridCell.menuItems.splice(index, 1); delete this._gridCell; dijit.CheckedMenuItem.prototype.destroy.apply(this, arguments); } }); cell.menuItems.push(item); return item; }, this); // dijit.CheckedMenuItem[] }, _setHeaderMenuAttr: function(menu){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this._placeholders = []; } if(this.headerMenu){ this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.headerMenu = menu; if(!menu){ return; } this.headerMenu.bindDomNode(this.viewsHeaderNode); if(this.headerMenu.getPlaceholders){ this._placeholders = this.headerMenu.getPlaceholders(this.placeholderLabel); } }, setHeaderMenu: function(/* dijit.Menu */ menu){ dojo.deprecated("dojox.grid._Grid.setHeaderMenu(obj)", "use dojox.grid._Grid.attr('headerMenu', obj) instead.", "2.0"); this._setHeaderMenuAttr(menu); }, setupHeaderMenu: function(){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ if(p._replaced){ p.unReplace(true); } p.replace(this.getColumnTogglingItems()); }, this); } }, _fetch: function(start){ this.setScrollTop(0); }, getItem: function(inRowIndex){ return null; }, showMessage: function(message){ if(message){ this.messagesNode.innerHTML = message; this.messagesNode.style.display = ""; }else{ this.messagesNode.innerHTML = ""; this.messagesNode.style.display = "none"; } }, _structureChanged: function() { this.buildViews(); if(this.autoRender && this._started){ this.render(); } }, hasLayout: function() { return this.layout.cells.length; }, // sizing resize: function(changeSize, resultSize){ // summary: // Update the grid's rendering dimensions and resize it this._resize(changeSize, resultSize); this.sizeChange(); }, _getPadBorder: function() { this._padBorder = this._padBorder || dojo._getPadBorderExtents(this.domNode); return this._padBorder; }, _getHeaderHeight: function(){ var vns = this.viewsHeaderNode.style, t = vns.display == "none" ? 0 : this.views.measureHeader(); vns.height = t + 'px'; // header heights are reset during measuring so must be normalized after measuring. this.views.normalizeHeaderNodeHeight(); return t; }, _resize: function(changeSize, resultSize){ // if we have set up everything except the DOM, we cannot resize var pn = this.domNode.parentNode; if(!pn || pn.nodeType != 1 || !this.hasLayout() || pn.style.visibility == "hidden" || pn.style.display == "none"){ return; } // useful measurement var padBorder = this._getPadBorder(); var hh = 0; // grid height if(this._autoHeight){ this.domNode.style.height = 'auto'; this.viewsNode.style.height = ''; }else if(typeof this.autoHeight == "number"){ var h = hh = this._getHeaderHeight(); h += (this.scroller.averageRowHeight * this.autoHeight); this.domNode.style.height = h + "px"; }else if(this.flex > 0){ }else if(this.domNode.clientHeight <= padBorder.h){ if(pn == document.body){ this.domNode.style.height = this.defaultHeight; }else if(this.height){ this.domNode.style.height = this.height; }else{ this.fitTo = "parent"; } } // if we are given dimensions, size the grid's domNode to those dimensions if(resultSize){ changeSize = resultSize; } if(changeSize){ dojo.marginBox(this.domNode, changeSize); this.height = this.domNode.style.height; delete this.fitTo; }else if(this.fitTo == "parent"){ var h = dojo._getContentBox(pn).h; dojo.marginBox(this.domNode, { h: Math.max(0, h) }); } var h = dojo._getContentBox(this.domNode).h; if(h == 0 && !this._autoHeight){ // We need to hide the header, since the Grid is essentially hidden. this.viewsHeaderNode.style.display = "none"; }else{ // Otherwise, show the header and give it an appropriate height. this.viewsHeaderNode.style.display = "block"; hh = this._getHeaderHeight(); } // NOTE: it is essential that width be applied before height // Header height can only be calculated properly after view widths have been set. // This is because flex column width is naturally 0 in Firefox. // Therefore prior to width sizing flex columns with spaces are maximally wrapped // and calculated to be too tall. this.adaptWidth(); this.adaptHeight(hh); this.postresize(); }, adaptWidth: function() { // private: sets width and position for views and update grid width if necessary var w = this.autoWidth ? 0 : this.domNode.clientWidth || (this.domNode.offsetWidth - this._getPadBorder().w), vw = this.views.arrange(1, w); this.views.onEach("adaptWidth"); if (this.autoWidth) this.domNode.style.width = vw + "px"; }, adaptHeight: function(inHeaderHeight){ // private: measures and normalizes header height, then sets view heights, and then updates scroller // content extent var t = inHeaderHeight || this._getHeaderHeight(); var h = (this._autoHeight ? -1 : Math.max(this.domNode.clientHeight - t, 0) || 0); this.views.onEach('setSize', [0, h]); this.views.onEach('adaptHeight'); if(!this._autoHeight){ var numScroll = 0, numNoScroll = 0; var noScrolls = dojo.filter(this.views.views, function(v){ var has = v.hasHScrollbar(); if(has){ numScroll++; }else{ numNoScroll++; } return (!has); }); if(numScroll > 0 && numNoScroll > 0){ dojo.forEach(noScrolls, function(v){ v.adaptHeight(true); }); } } if(this.autoHeight === true || h != -1 || (typeof this.autoHeight == "number" && this.autoHeight >= this.attr('rowCount'))){ this.scroller.windowHeight = h; }else{ this.scroller.windowHeight = Math.max(this.domNode.clientHeight - t, 0); }";s:7:"summary";s:0:"";}s:24:"dojox.grid._Grid.startup";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:114:" if(this._started){return;} this.inherited(arguments); if(this.autoRender){ this.render(); }";s:7:"summary";s:0:"";}s:23:"dojox.grid._Grid.render";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:228:" if(!this.domNode){return;} if(!this._started){return;} if(!this.hasLayout()) { this.scroller.init(0, this.keepRows, this.rowsPerPage); return; } // this.update = this.defaultUpdate; this._render();";s:7:"summary";s:122:"Render the grid, headers, and views. Edit and scrolling states are reset. To retain edit and scrolling states, see Update.";}s:24:"dojox.grid._Grid._render";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:146:" this.scroller.init(this.attr('rowCount'), this.keepRows, this.rowsPerPage); this.prerender(); this.setScrollTop(0); this.postrender();";s:7:"private";b:1;s:7:"summary";s:0:"";}s:26:"dojox.grid._Grid.prerender";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:25822:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); } }, _getRowCountAttr: function(){ return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount; }, styleChanged: function(){ this.setStyledClass(this.domNode, ''); }, _styleChanged: function(){ this.styleChanged(); this.update(); }, textSizeChanged: function(){ setTimeout(dojo.hitch(this, "_textSizeChanged"), 1); }, _textSizeChanged: function(){ if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); } }, sizeChange: function(){ jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update")); }, renderOnIdle: function() { setTimeout(dojo.hitch(this, "render"), 1); }, createManagers: function(){ // summary: // create grid managers for various tasks including rows, focus, selection, editing // row manager this.rows = new dojox.grid._RowManager(this); // focus manager this.focus = new dojox.grid._FocusManager(this); // edit manager this.edit = new dojox.grid._EditManager(this); }, createSelection: function(){ // summary: Creates a new Grid selection manager. // selection manager this.selection = new dojox.grid.Selection(this); }, createScroller: function(){ // summary: Creates a new virtual scroller this.scroller = new dojox.grid._Scroller(); this.scroller.grid = this; this.scroller._pageIdPrefix = this.id + '-'; this.scroller.renderRow = dojo.hitch(this, "renderRow"); this.scroller.removeRow = dojo.hitch(this, "rowRemoved"); }, createLayout: function(){ // summary: Creates a new Grid layout this.layout = new dojox.grid._Layout(this); this.connect(this.layout, "moveColumn", "onMoveColumn"); }, onMoveColumn: function(){ this.render(); this._resize(); }, // views createViews: function(){ this.views = new dojox.grid._ViewManager(this); this.views.createView = dojo.hitch(this, "createView"); }, createView: function(inClass, idx){ var c = dojo.getObject(inClass); var view = new c({ grid: this, index: idx }); this.viewsNode.appendChild(view.domNode); this.viewsHeaderNode.appendChild(view.headerNode); this.views.addView(view); return view; }, buildViews: function(){ for(var i=0, vs; (vs=this.layout.structure[i]); i++){ this.createView(vs.type || dojox._scopeName + ".grid._View", i).setStructure(vs); } this.scroller.setContentNodes(this.views.getContentNodes()); }, _setStructureAttr: function(structure){ var s = structure; if(s && dojo.isString(s)){ dojo.deprecated("dojox.grid._Grid.attr('structure', 'objVar')", "use dojox.grid._Grid.attr('structure', objVar) instead", "2.0"); s=dojo.getObject(s); } this.structure = s; if(!s){ if(this.layout.structure){ s = this.layout.structure; }else{ return; } } this.views.destroyViews(); if(s !== this.layout.structure){ this.layout.setStructure(s); } this._structureChanged(); }, setStructure: function(/* dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] */ inStructure){ // summary: // Install a new structure and rebuild the grid. dojo.deprecated("dojox.grid._Grid.setStructure(obj)", "use dojox.grid._Grid.attr('structure', obj) instead.", "2.0"); this._setStructureAttr(inStructure); }, getColumnTogglingItems: function(){ // Summary: returns an array of dijit.CheckedMenuItem widgets that can be // added to a menu for toggling columns on and off. return dojo.map(this.layout.cells, function(cell){ if(!cell.menuItems){ cell.menuItems = []; } var self = this; var item = new dijit.CheckedMenuItem({ label: cell.name, checked: !cell.hidden, _gridCell: cell, onChange: function(checked){ if(self.layout.setColumnVisibility(this._gridCell.index, checked)){ var items = this._gridCell.menuItems; if(items.length > 1){ dojo.forEach(items, function(item){ if(item !== this){ item.setAttribute("checked", checked); } }, this); } var checked = dojo.filter(self.layout.cells, function(c){ if(c.menuItems.length > 1){ dojo.forEach(c.menuItems, "item.attr('disabled', false);"); }else{ c.menuItems[0].attr('disabled', false); } return !c.hidden; }); if(checked.length == 1){ dojo.forEach(checked[0].menuItems, "item.attr('disabled', true);"); } } }, destroy: function(){ var index = dojo.indexOf(this._gridCell.menuItems, this); this._gridCell.menuItems.splice(index, 1); delete this._gridCell; dijit.CheckedMenuItem.prototype.destroy.apply(this, arguments); } }); cell.menuItems.push(item); return item; }, this); // dijit.CheckedMenuItem[] }, _setHeaderMenuAttr: function(menu){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this._placeholders = []; } if(this.headerMenu){ this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.headerMenu = menu; if(!menu){ return; } this.headerMenu.bindDomNode(this.viewsHeaderNode); if(this.headerMenu.getPlaceholders){ this._placeholders = this.headerMenu.getPlaceholders(this.placeholderLabel); } }, setHeaderMenu: function(/* dijit.Menu */ menu){ dojo.deprecated("dojox.grid._Grid.setHeaderMenu(obj)", "use dojox.grid._Grid.attr('headerMenu', obj) instead.", "2.0"); this._setHeaderMenuAttr(menu); }, setupHeaderMenu: function(){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ if(p._replaced){ p.unReplace(true); } p.replace(this.getColumnTogglingItems()); }, this); } }, _fetch: function(start){ this.setScrollTop(0); }, getItem: function(inRowIndex){ return null; }, showMessage: function(message){ if(message){ this.messagesNode.innerHTML = message; this.messagesNode.style.display = ""; }else{ this.messagesNode.innerHTML = ""; this.messagesNode.style.display = "none"; } }, _structureChanged: function() { this.buildViews(); if(this.autoRender && this._started){ this.render(); } }, hasLayout: function() { return this.layout.cells.length; }, // sizing resize: function(changeSize, resultSize){ // summary: // Update the grid's rendering dimensions and resize it this._resize(changeSize, resultSize); this.sizeChange(); }, _getPadBorder: function() { this._padBorder = this._padBorder || dojo._getPadBorderExtents(this.domNode); return this._padBorder; }, _getHeaderHeight: function(){ var vns = this.viewsHeaderNode.style, t = vns.display == "none" ? 0 : this.views.measureHeader(); vns.height = t + 'px'; // header heights are reset during measuring so must be normalized after measuring. this.views.normalizeHeaderNodeHeight(); return t; }, _resize: function(changeSize, resultSize){ // if we have set up everything except the DOM, we cannot resize var pn = this.domNode.parentNode; if(!pn || pn.nodeType != 1 || !this.hasLayout() || pn.style.visibility == "hidden" || pn.style.display == "none"){ return; } // useful measurement var padBorder = this._getPadBorder(); var hh = 0; // grid height if(this._autoHeight){ this.domNode.style.height = 'auto'; this.viewsNode.style.height = ''; }else if(typeof this.autoHeight == "number"){ var h = hh = this._getHeaderHeight(); h += (this.scroller.averageRowHeight * this.autoHeight); this.domNode.style.height = h + "px"; }else if(this.flex > 0){ }else if(this.domNode.clientHeight <= padBorder.h){ if(pn == document.body){ this.domNode.style.height = this.defaultHeight; }else if(this.height){ this.domNode.style.height = this.height; }else{ this.fitTo = "parent"; } } // if we are given dimensions, size the grid's domNode to those dimensions if(resultSize){ changeSize = resultSize; } if(changeSize){ dojo.marginBox(this.domNode, changeSize); this.height = this.domNode.style.height; delete this.fitTo; }else if(this.fitTo == "parent"){ var h = dojo._getContentBox(pn).h; dojo.marginBox(this.domNode, { h: Math.max(0, h) }); } var h = dojo._getContentBox(this.domNode).h; if(h == 0 && !this._autoHeight){ // We need to hide the header, since the Grid is essentially hidden. this.viewsHeaderNode.style.display = "none"; }else{ // Otherwise, show the header and give it an appropriate height. this.viewsHeaderNode.style.display = "block"; hh = this._getHeaderHeight(); } // NOTE: it is essential that width be applied before height // Header height can only be calculated properly after view widths have been set. // This is because flex column width is naturally 0 in Firefox. // Therefore prior to width sizing flex columns with spaces are maximally wrapped // and calculated to be too tall. this.adaptWidth(); this.adaptHeight(hh); this.postresize(); }, adaptWidth: function() { // private: sets width and position for views and update grid width if necessary var w = this.autoWidth ? 0 : this.domNode.clientWidth || (this.domNode.offsetWidth - this._getPadBorder().w), vw = this.views.arrange(1, w); this.views.onEach("adaptWidth"); if (this.autoWidth) this.domNode.style.width = vw + "px"; }, adaptHeight: function(inHeaderHeight){ // private: measures and normalizes header height, then sets view heights, and then updates scroller // content extent var t = inHeaderHeight || this._getHeaderHeight(); var h = (this._autoHeight ? -1 : Math.max(this.domNode.clientHeight - t, 0) || 0); this.views.onEach('setSize', [0, h]); this.views.onEach('adaptHeight'); if(!this._autoHeight){ var numScroll = 0, numNoScroll = 0; var noScrolls = dojo.filter(this.views.views, function(v){ var has = v.hasHScrollbar(); if(has){ numScroll++; }else{ numNoScroll++; } return (!has); }); if(numScroll > 0 && numNoScroll > 0){ dojo.forEach(noScrolls, function(v){ v.adaptHeight(true); }); } } if(this.autoHeight === true || h != -1 || (typeof this.autoHeight == "number" && this.autoHeight >= this.attr('rowCount'))){ this.scroller.windowHeight = h; }else{ this.scroller.windowHeight = Math.max(this.domNode.clientHeight - t, 0); } }, // startup startup: function(){ if(this._started){return;} this.inherited(arguments); if(this.autoRender){ this.render(); } }, // render render: function(){ // summary: // Render the grid, headers, and views. Edit and scrolling states are reset. To retain edit and // scrolling states, see Update. if(!this.domNode){return;} if(!this._started){return;} if(!this.hasLayout()) { this.scroller.init(0, this.keepRows, this.rowsPerPage); return; } // this.update = this.defaultUpdate; this._render(); }, _render: function(){ this.scroller.init(this.attr('rowCount'), this.keepRows, this.rowsPerPage); this.prerender(); this.setScrollTop(0); this.postrender(); }, prerender: function(){ // if autoHeight, make sure scroller knows not to virtualize; everything must be rendered. this.keepRows = this._autoHeight ? 0 : this.keepRows; this.scroller.setKeepInfo(this.keepRows); this.views.render(); this._resize();";s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.postrender";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:135:" this.postresize(); this.focus.initFocusView(); // make rows unselectable dojo.setSelectable(this.domNode, this.selectable);";s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.postresize";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:26224:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); } }, _getRowCountAttr: function(){ return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount; }, styleChanged: function(){ this.setStyledClass(this.domNode, ''); }, _styleChanged: function(){ this.styleChanged(); this.update(); }, textSizeChanged: function(){ setTimeout(dojo.hitch(this, "_textSizeChanged"), 1); }, _textSizeChanged: function(){ if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); } }, sizeChange: function(){ jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update")); }, renderOnIdle: function() { setTimeout(dojo.hitch(this, "render"), 1); }, createManagers: function(){ // summary: // create grid managers for various tasks including rows, focus, selection, editing // row manager this.rows = new dojox.grid._RowManager(this); // focus manager this.focus = new dojox.grid._FocusManager(this); // edit manager this.edit = new dojox.grid._EditManager(this); }, createSelection: function(){ // summary: Creates a new Grid selection manager. // selection manager this.selection = new dojox.grid.Selection(this); }, createScroller: function(){ // summary: Creates a new virtual scroller this.scroller = new dojox.grid._Scroller(); this.scroller.grid = this; this.scroller._pageIdPrefix = this.id + '-'; this.scroller.renderRow = dojo.hitch(this, "renderRow"); this.scroller.removeRow = dojo.hitch(this, "rowRemoved"); }, createLayout: function(){ // summary: Creates a new Grid layout this.layout = new dojox.grid._Layout(this); this.connect(this.layout, "moveColumn", "onMoveColumn"); }, onMoveColumn: function(){ this.render(); this._resize(); }, // views createViews: function(){ this.views = new dojox.grid._ViewManager(this); this.views.createView = dojo.hitch(this, "createView"); }, createView: function(inClass, idx){ var c = dojo.getObject(inClass); var view = new c({ grid: this, index: idx }); this.viewsNode.appendChild(view.domNode); this.viewsHeaderNode.appendChild(view.headerNode); this.views.addView(view); return view; }, buildViews: function(){ for(var i=0, vs; (vs=this.layout.structure[i]); i++){ this.createView(vs.type || dojox._scopeName + ".grid._View", i).setStructure(vs); } this.scroller.setContentNodes(this.views.getContentNodes()); }, _setStructureAttr: function(structure){ var s = structure; if(s && dojo.isString(s)){ dojo.deprecated("dojox.grid._Grid.attr('structure', 'objVar')", "use dojox.grid._Grid.attr('structure', objVar) instead", "2.0"); s=dojo.getObject(s); } this.structure = s; if(!s){ if(this.layout.structure){ s = this.layout.structure; }else{ return; } } this.views.destroyViews(); if(s !== this.layout.structure){ this.layout.setStructure(s); } this._structureChanged(); }, setStructure: function(/* dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] */ inStructure){ // summary: // Install a new structure and rebuild the grid. dojo.deprecated("dojox.grid._Grid.setStructure(obj)", "use dojox.grid._Grid.attr('structure', obj) instead.", "2.0"); this._setStructureAttr(inStructure); }, getColumnTogglingItems: function(){ // Summary: returns an array of dijit.CheckedMenuItem widgets that can be // added to a menu for toggling columns on and off. return dojo.map(this.layout.cells, function(cell){ if(!cell.menuItems){ cell.menuItems = []; } var self = this; var item = new dijit.CheckedMenuItem({ label: cell.name, checked: !cell.hidden, _gridCell: cell, onChange: function(checked){ if(self.layout.setColumnVisibility(this._gridCell.index, checked)){ var items = this._gridCell.menuItems; if(items.length > 1){ dojo.forEach(items, function(item){ if(item !== this){ item.setAttribute("checked", checked); } }, this); } var checked = dojo.filter(self.layout.cells, function(c){ if(c.menuItems.length > 1){ dojo.forEach(c.menuItems, "item.attr('disabled', false);"); }else{ c.menuItems[0].attr('disabled', false); } return !c.hidden; }); if(checked.length == 1){ dojo.forEach(checked[0].menuItems, "item.attr('disabled', true);"); } } }, destroy: function(){ var index = dojo.indexOf(this._gridCell.menuItems, this); this._gridCell.menuItems.splice(index, 1); delete this._gridCell; dijit.CheckedMenuItem.prototype.destroy.apply(this, arguments); } }); cell.menuItems.push(item); return item; }, this); // dijit.CheckedMenuItem[] }, _setHeaderMenuAttr: function(menu){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this._placeholders = []; } if(this.headerMenu){ this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.headerMenu = menu; if(!menu){ return; } this.headerMenu.bindDomNode(this.viewsHeaderNode); if(this.headerMenu.getPlaceholders){ this._placeholders = this.headerMenu.getPlaceholders(this.placeholderLabel); } }, setHeaderMenu: function(/* dijit.Menu */ menu){ dojo.deprecated("dojox.grid._Grid.setHeaderMenu(obj)", "use dojox.grid._Grid.attr('headerMenu', obj) instead.", "2.0"); this._setHeaderMenuAttr(menu); }, setupHeaderMenu: function(){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ if(p._replaced){ p.unReplace(true); } p.replace(this.getColumnTogglingItems()); }, this); } }, _fetch: function(start){ this.setScrollTop(0); }, getItem: function(inRowIndex){ return null; }, showMessage: function(message){ if(message){ this.messagesNode.innerHTML = message; this.messagesNode.style.display = ""; }else{ this.messagesNode.innerHTML = ""; this.messagesNode.style.display = "none"; } }, _structureChanged: function() { this.buildViews(); if(this.autoRender && this._started){ this.render(); } }, hasLayout: function() { return this.layout.cells.length; }, // sizing resize: function(changeSize, resultSize){ // summary: // Update the grid's rendering dimensions and resize it this._resize(changeSize, resultSize); this.sizeChange(); }, _getPadBorder: function() { this._padBorder = this._padBorder || dojo._getPadBorderExtents(this.domNode); return this._padBorder; }, _getHeaderHeight: function(){ var vns = this.viewsHeaderNode.style, t = vns.display == "none" ? 0 : this.views.measureHeader(); vns.height = t + 'px'; // header heights are reset during measuring so must be normalized after measuring. this.views.normalizeHeaderNodeHeight(); return t; }, _resize: function(changeSize, resultSize){ // if we have set up everything except the DOM, we cannot resize var pn = this.domNode.parentNode; if(!pn || pn.nodeType != 1 || !this.hasLayout() || pn.style.visibility == "hidden" || pn.style.display == "none"){ return; } // useful measurement var padBorder = this._getPadBorder(); var hh = 0; // grid height if(this._autoHeight){ this.domNode.style.height = 'auto'; this.viewsNode.style.height = ''; }else if(typeof this.autoHeight == "number"){ var h = hh = this._getHeaderHeight(); h += (this.scroller.averageRowHeight * this.autoHeight); this.domNode.style.height = h + "px"; }else if(this.flex > 0){ }else if(this.domNode.clientHeight <= padBorder.h){ if(pn == document.body){ this.domNode.style.height = this.defaultHeight; }else if(this.height){ this.domNode.style.height = this.height; }else{ this.fitTo = "parent"; } } // if we are given dimensions, size the grid's domNode to those dimensions if(resultSize){ changeSize = resultSize; } if(changeSize){ dojo.marginBox(this.domNode, changeSize); this.height = this.domNode.style.height; delete this.fitTo; }else if(this.fitTo == "parent"){ var h = dojo._getContentBox(pn).h; dojo.marginBox(this.domNode, { h: Math.max(0, h) }); } var h = dojo._getContentBox(this.domNode).h; if(h == 0 && !this._autoHeight){ // We need to hide the header, since the Grid is essentially hidden. this.viewsHeaderNode.style.display = "none"; }else{ // Otherwise, show the header and give it an appropriate height. this.viewsHeaderNode.style.display = "block"; hh = this._getHeaderHeight(); } // NOTE: it is essential that width be applied before height // Header height can only be calculated properly after view widths have been set. // This is because flex column width is naturally 0 in Firefox. // Therefore prior to width sizing flex columns with spaces are maximally wrapped // and calculated to be too tall. this.adaptWidth(); this.adaptHeight(hh); this.postresize(); }, adaptWidth: function() { // private: sets width and position for views and update grid width if necessary var w = this.autoWidth ? 0 : this.domNode.clientWidth || (this.domNode.offsetWidth - this._getPadBorder().w), vw = this.views.arrange(1, w); this.views.onEach("adaptWidth"); if (this.autoWidth) this.domNode.style.width = vw + "px"; }, adaptHeight: function(inHeaderHeight){ // private: measures and normalizes header height, then sets view heights, and then updates scroller // content extent var t = inHeaderHeight || this._getHeaderHeight(); var h = (this._autoHeight ? -1 : Math.max(this.domNode.clientHeight - t, 0) || 0); this.views.onEach('setSize', [0, h]); this.views.onEach('adaptHeight'); if(!this._autoHeight){ var numScroll = 0, numNoScroll = 0; var noScrolls = dojo.filter(this.views.views, function(v){ var has = v.hasHScrollbar(); if(has){ numScroll++; }else{ numNoScroll++; } return (!has); }); if(numScroll > 0 && numNoScroll > 0){ dojo.forEach(noScrolls, function(v){ v.adaptHeight(true); }); } } if(this.autoHeight === true || h != -1 || (typeof this.autoHeight == "number" && this.autoHeight >= this.attr('rowCount'))){ this.scroller.windowHeight = h; }else{ this.scroller.windowHeight = Math.max(this.domNode.clientHeight - t, 0); } }, // startup startup: function(){ if(this._started){return;} this.inherited(arguments); if(this.autoRender){ this.render(); } }, // render render: function(){ // summary: // Render the grid, headers, and views. Edit and scrolling states are reset. To retain edit and // scrolling states, see Update. if(!this.domNode){return;} if(!this._started){return;} if(!this.hasLayout()) { this.scroller.init(0, this.keepRows, this.rowsPerPage); return; } // this.update = this.defaultUpdate; this._render(); }, _render: function(){ this.scroller.init(this.attr('rowCount'), this.keepRows, this.rowsPerPage); this.prerender(); this.setScrollTop(0); this.postrender(); }, prerender: function(){ // if autoHeight, make sure scroller knows not to virtualize; everything must be rendered. this.keepRows = this._autoHeight ? 0 : this.keepRows; this.scroller.setKeepInfo(this.keepRows); this.views.render(); this._resize(); }, postrender: function(){ this.postresize(); this.focus.initFocusView(); // make rows unselectable dojo.setSelectable(this.domNode, this.selectable); }, postresize: function(){ // views are position absolute, so they do not inflate the parent if(this._autoHeight){ var size = Math.max(this.views.measureContent()) + 'px'; this.viewsNode.style.height = size; }";s:7:"summary";s:0:"";}s:26:"dojox.grid._Grid.renderRow";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:10:"inRowIndex";a:1:{s:4:"type";s:0:"";}s:7:"inNodes";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:45:" this.views.renderRow(inRowIndex, inNodes);";s:7:"summary";s:39:"private, used internally to render rows";}s:27:"dojox.grid._Grid.rowRemoved";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inRowIndex";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:37:" this.views.rowRemoved(inRowIndex);";s:7:"summary";s:39:"private, used internally to remove rows";}s:28:"dojox.grid._Grid.invalidated";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:25:"dojox.grid._Grid.updating";a:3:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:28:"dojox.grid._Grid.beginUpdate";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:50:" this.invalidated = []; this.updating = true;";s:7:"summary";s:125:"Use to make multiple changes to rows while queueing row updating. NOTE: not currently supporting nested begin/endUpdate calls";}s:26:"dojox.grid._Grid.endUpdate";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:263:" this.updating = false; var i = this.invalidated, r; if(i.all){ this.update(); }else if(i.rowCount != undefined){ this.updateRowCount(i.rowCount); }else{ for(r in i){ this.updateRow(Number(r)); } } this.invalidated = null;";s:7:"summary";s:65:"Use after calling beginUpdate to render any changes made to rows.";}s:30:"dojox.grid._Grid.defaultUpdate";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:27635:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow; } dojo.declare('dojox.grid._Grid', [ dijit._Widget, dijit._Templated, dojox.grid._Events ], { // summary: // A grid widget with virtual scrolling, cell editing, complex rows, // sorting, fixed columns, sizeable columns, etc. // // description: // _Grid provides the full set of grid features without any // direct connection to a data store. // // The grid exposes a get function for the grid, or optionally // individual columns, to populate cell contents. // // The grid is rendered based on its structure, an object describing // column and cell layout. // // example: // A quick sample: // // define a get function // | function get(inRowIndex){ // called in cell context // | return [this.index, inRowIndex].join(', '); // | } // // define the grid structure: // | var structure = [ // array of view objects // | { cells: [// array of rows, a row is an array of cells // | [ // | { name: "Alpha", width: 6 }, // | { name: "Beta" }, // | { name: "Gamma", get: get }] // | ]} // | ]; // // |
templatePath: dojo.moduleUrl("dojox.grid","resources/_Grid.html"), // classTag: String // CSS class applied to the grid's domNode classTag: 'dojoxGrid', get: function(inRowIndex){ // summary: Default data getter. // description: // Provides data to display in a grid cell. Called in grid cell context. // So this.cell.index is the column index. // inRowIndex: Integer // Row for which to provide data // returns: // Data to display for a given grid cell. }, // settings // rowCount: Integer // Number of rows to display. rowCount: 5, // keepRows: Integer // Number of rows to keep in the rendering cache. keepRows: 75, // rowsPerPage: Integer // Number of rows to render at a time. rowsPerPage: 25, // autoWidth: Boolean // If autoWidth is true, grid width is automatically set to fit the data. autoWidth: false, // autoHeight: Boolean|Integer // If autoHeight is true, grid height is automatically set to fit the data. // If it is an integer, the height will be automatically set to fit the data // if there are fewer than that many rows - and the height will be set to show // that many rows if there are more autoHeight: '', // autoRender: Boolean // If autoRender is true, grid will render itself after initialization. autoRender: true, // defaultHeight: String // default height of the grid, measured in any valid css unit. defaultHeight: '15em', // height: String // explicit height of the grid, measured in any valid css unit. This will be populated (and overridden) // if the height: css attribute exists on the source node. height: '', // structure: dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] // View layout defintion. structure: null, // elasticView: Integer // Override defaults and make the indexed grid view elastic, thus filling available horizontal space. elasticView: -1, // singleClickEdit: boolean // Single-click starts editing. Default is double-click singleClickEdit: false, // selectionMode: String // Set the selection mode of grid's Selection. Value must be 'single', 'multiple', // or 'extended'. Default is 'extended'. selectionMode: 'extended', // rowSelector: Boolean|String // If set to true, will add a row selector view to this grid. If set to a CSS width, will add // a row selector of that width to this grid. rowSelector: '', // columnReordering: Boolean // If set to true, will add drag and drop reordering to views with one row of columns. columnReordering: false, // headerMenu: dijit.Menu // If set to a dijit.Menu, will use this as a context menu for the grid headers. headerMenu: null, // placeholderLabel: String // Label of placeholders to search for in the header menu to replace with column toggling // menu items. placeholderLabel: "GridColumns", // selectable: Boolean // Set to true if you want to be able to select the text within the grid. selectable: false, // Used to store the last two clicks, to ensure double-clicking occurs based on the intended row _click: null, // loadingMessage: String // Message that shows while the grid is loading loadingMessage: "${loadingState}", // errorMessage: String // Message that shows when the grid encounters an error loading errorMessage: "${errorState}", // noDataMessage: String // Message that shows if the grid has no data - wrap it in a // span with class 'dojoxGridNoData' if you want it to be // styled similar to the loading and error messages noDataMessage: "", // private sortInfo: 0, themeable: true, _placeholders: null, // initialization buildRendering: function(){ this.inherited(arguments); // reset get from blank function (needed for markup parsing) to null, if not changed if(this.get == dojox.grid._Grid.prototype.get){ this.get = null; } if(!this.domNode.getAttribute('tabIndex')){ this.domNode.tabIndex = "0"; } this.createScroller(); this.createLayout(); this.createViews(); this.createManagers(); this.createSelection(); this.connect(this.selection, "onSelected", "onSelected"); this.connect(this.selection, "onDeselected", "onDeselected"); this.connect(this.selection, "onChanged", "onSelectionChanged"); dojox.html.metrics.initOnFontResize(); this.connect(dojox.html.metrics, "onFontResize", "textSizeChanged"); dojox.grid.util.funnelEvents(this.domNode, this, 'doKeyEvent', dojox.grid.util.keyEvents); this.connect(this, "onShow", "renderOnIdle"); }, postMixInProperties: function(){ this.inherited(arguments); var messages = dojo.i18n.getLocalization("dijit", "loading", this.lang); this.loadingMessage = dojo.string.substitute(this.loadingMessage, messages); this.errorMessage = dojo.string.substitute(this.errorMessage, messages); if(this.srcNodeRef && this.srcNodeRef.style.height){ this.height = this.srcNodeRef.style.height; } // Call this to update our autoheight to start out this._setAutoHeightAttr(this.autoHeight, true); }, postCreate: function(){ // replace stock styleChanged with one that triggers an update this.styleChanged = this._styleChanged; this._placeholders = []; this._setHeaderMenuAttr(this.headerMenu); this._setStructureAttr(this.structure); this._click = []; }, destroy: function(){ this.domNode.onReveal = null; this.domNode.onSizeChange = null; // Fixes IE domNode leak delete this._click; this.edit.destroy(); delete this.edit; this.views.destroyViews(); if(this.scroller){ this.scroller.destroy(); delete this.scroller; } if(this.focus){ this.focus.destroy(); delete this.focus; } if(this.headerMenu&&this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.inherited(arguments); }, _setAutoHeightAttr: function(ah, skipRender){ // Calculate our autoheight - turn it into a boolean or an integer if(typeof ah == "string"){ if(!ah || ah == "false"){ ah = false; }else if (ah == "true"){ ah = true; }else{ ah = window.parseInt(ah, 10); } } if(typeof ah == "number"){ if(isNaN(ah)){ ah = false; } // Autoheight must be at least 1, if it's a number. If it's // less than 0, we'll take that to mean "all" rows (same as // autoHeight=true - if it is equal to zero, we'll take that // to mean autoHeight=false if(ah < 0){ ah = true; }else if (ah === 0){ ah = false; } } this.autoHeight = ah; if(typeof ah == "boolean"){ this._autoHeight = ah; }else if(typeof ah == "number"){ this._autoHeight = (ah >= this.attr('rowCount')); }else{ this._autoHeight = false; } if(this._started && !skipRender){ this.render(); } }, _getRowCountAttr: function(){ return this.updating && this.invalidated && this.invalidated.rowCount != undefined ? this.invalidated.rowCount : this.rowCount; }, styleChanged: function(){ this.setStyledClass(this.domNode, ''); }, _styleChanged: function(){ this.styleChanged(); this.update(); }, textSizeChanged: function(){ setTimeout(dojo.hitch(this, "_textSizeChanged"), 1); }, _textSizeChanged: function(){ if(this.domNode){ this.views.forEach(function(v){ v.content.update(); }); this.render(); } }, sizeChange: function(){ jobs.job(this.id + 'SizeChange', 50, dojo.hitch(this, "update")); }, renderOnIdle: function() { setTimeout(dojo.hitch(this, "render"), 1); }, createManagers: function(){ // summary: // create grid managers for various tasks including rows, focus, selection, editing // row manager this.rows = new dojox.grid._RowManager(this); // focus manager this.focus = new dojox.grid._FocusManager(this); // edit manager this.edit = new dojox.grid._EditManager(this); }, createSelection: function(){ // summary: Creates a new Grid selection manager. // selection manager this.selection = new dojox.grid.Selection(this); }, createScroller: function(){ // summary: Creates a new virtual scroller this.scroller = new dojox.grid._Scroller(); this.scroller.grid = this; this.scroller._pageIdPrefix = this.id + '-'; this.scroller.renderRow = dojo.hitch(this, "renderRow"); this.scroller.removeRow = dojo.hitch(this, "rowRemoved"); }, createLayout: function(){ // summary: Creates a new Grid layout this.layout = new dojox.grid._Layout(this); this.connect(this.layout, "moveColumn", "onMoveColumn"); }, onMoveColumn: function(){ this.render(); this._resize(); }, // views createViews: function(){ this.views = new dojox.grid._ViewManager(this); this.views.createView = dojo.hitch(this, "createView"); }, createView: function(inClass, idx){ var c = dojo.getObject(inClass); var view = new c({ grid: this, index: idx }); this.viewsNode.appendChild(view.domNode); this.viewsHeaderNode.appendChild(view.headerNode); this.views.addView(view); return view; }, buildViews: function(){ for(var i=0, vs; (vs=this.layout.structure[i]); i++){ this.createView(vs.type || dojox._scopeName + ".grid._View", i).setStructure(vs); } this.scroller.setContentNodes(this.views.getContentNodes()); }, _setStructureAttr: function(structure){ var s = structure; if(s && dojo.isString(s)){ dojo.deprecated("dojox.grid._Grid.attr('structure', 'objVar')", "use dojox.grid._Grid.attr('structure', objVar) instead", "2.0"); s=dojo.getObject(s); } this.structure = s; if(!s){ if(this.layout.structure){ s = this.layout.structure; }else{ return; } } this.views.destroyViews(); if(s !== this.layout.structure){ this.layout.setStructure(s); } this._structureChanged(); }, setStructure: function(/* dojox.grid.__ViewDef|dojox.grid.__ViewDef[]|dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]] */ inStructure){ // summary: // Install a new structure and rebuild the grid. dojo.deprecated("dojox.grid._Grid.setStructure(obj)", "use dojox.grid._Grid.attr('structure', obj) instead.", "2.0"); this._setStructureAttr(inStructure); }, getColumnTogglingItems: function(){ // Summary: returns an array of dijit.CheckedMenuItem widgets that can be // added to a menu for toggling columns on and off. return dojo.map(this.layout.cells, function(cell){ if(!cell.menuItems){ cell.menuItems = []; } var self = this; var item = new dijit.CheckedMenuItem({ label: cell.name, checked: !cell.hidden, _gridCell: cell, onChange: function(checked){ if(self.layout.setColumnVisibility(this._gridCell.index, checked)){ var items = this._gridCell.menuItems; if(items.length > 1){ dojo.forEach(items, function(item){ if(item !== this){ item.setAttribute("checked", checked); } }, this); } var checked = dojo.filter(self.layout.cells, function(c){ if(c.menuItems.length > 1){ dojo.forEach(c.menuItems, "item.attr('disabled', false);"); }else{ c.menuItems[0].attr('disabled', false); } return !c.hidden; }); if(checked.length == 1){ dojo.forEach(checked[0].menuItems, "item.attr('disabled', true);"); } } }, destroy: function(){ var index = dojo.indexOf(this._gridCell.menuItems, this); this._gridCell.menuItems.splice(index, 1); delete this._gridCell; dijit.CheckedMenuItem.prototype.destroy.apply(this, arguments); } }); cell.menuItems.push(item); return item; }, this); // dijit.CheckedMenuItem[] }, _setHeaderMenuAttr: function(menu){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ p.unReplace(true); }); this._placeholders = []; } if(this.headerMenu){ this.headerMenu.unBindDomNode(this.viewsHeaderNode); } this.headerMenu = menu; if(!menu){ return; } this.headerMenu.bindDomNode(this.viewsHeaderNode); if(this.headerMenu.getPlaceholders){ this._placeholders = this.headerMenu.getPlaceholders(this.placeholderLabel); } }, setHeaderMenu: function(/* dijit.Menu */ menu){ dojo.deprecated("dojox.grid._Grid.setHeaderMenu(obj)", "use dojox.grid._Grid.attr('headerMenu', obj) instead.", "2.0"); this._setHeaderMenuAttr(menu); }, setupHeaderMenu: function(){ if(this._placeholders && this._placeholders.length){ dojo.forEach(this._placeholders, function(p){ if(p._replaced){ p.unReplace(true); } p.replace(this.getColumnTogglingItems()); }, this); } }, _fetch: function(start){ this.setScrollTop(0); }, getItem: function(inRowIndex){ return null; }, showMessage: function(message){ if(message){ this.messagesNode.innerHTML = message; this.messagesNode.style.display = ""; }else{ this.messagesNode.innerHTML = ""; this.messagesNode.style.display = "none"; } }, _structureChanged: function() { this.buildViews(); if(this.autoRender && this._started){ this.render(); } }, hasLayout: function() { return this.layout.cells.length; }, // sizing resize: function(changeSize, resultSize){ // summary: // Update the grid's rendering dimensions and resize it this._resize(changeSize, resultSize); this.sizeChange(); }, _getPadBorder: function() { this._padBorder = this._padBorder || dojo._getPadBorderExtents(this.domNode); return this._padBorder; }, _getHeaderHeight: function(){ var vns = this.viewsHeaderNode.style, t = vns.display == "none" ? 0 : this.views.measureHeader(); vns.height = t + 'px'; // header heights are reset during measuring so must be normalized after measuring. this.views.normalizeHeaderNodeHeight(); return t; }, _resize: function(changeSize, resultSize){ // if we have set up everything except the DOM, we cannot resize var pn = this.domNode.parentNode; if(!pn || pn.nodeType != 1 || !this.hasLayout() || pn.style.visibility == "hidden" || pn.style.display == "none"){ return; } // useful measurement var padBorder = this._getPadBorder(); var hh = 0; // grid height if(this._autoHeight){ this.domNode.style.height = 'auto'; this.viewsNode.style.height = ''; }else if(typeof this.autoHeight == "number"){ var h = hh = this._getHeaderHeight(); h += (this.scroller.averageRowHeight * this.autoHeight); this.domNode.style.height = h + "px"; }else if(this.flex > 0){ }else if(this.domNode.clientHeight <= padBorder.h){ if(pn == document.body){ this.domNode.style.height = this.defaultHeight; }else if(this.height){ this.domNode.style.height = this.height; }else{ this.fitTo = "parent"; } } // if we are given dimensions, size the grid's domNode to those dimensions if(resultSize){ changeSize = resultSize; } if(changeSize){ dojo.marginBox(this.domNode, changeSize); this.height = this.domNode.style.height; delete this.fitTo; }else if(this.fitTo == "parent"){ var h = dojo._getContentBox(pn).h; dojo.marginBox(this.domNode, { h: Math.max(0, h) }); } var h = dojo._getContentBox(this.domNode).h; if(h == 0 && !this._autoHeight){ // We need to hide the header, since the Grid is essentially hidden. this.viewsHeaderNode.style.display = "none"; }else{ // Otherwise, show the header and give it an appropriate height. this.viewsHeaderNode.style.display = "block"; hh = this._getHeaderHeight(); } // NOTE: it is essential that width be applied before height // Header height can only be calculated properly after view widths have been set. // This is because flex column width is naturally 0 in Firefox. // Therefore prior to width sizing flex columns with spaces are maximally wrapped // and calculated to be too tall. this.adaptWidth(); this.adaptHeight(hh); this.postresize(); }, adaptWidth: function() { // private: sets width and position for views and update grid width if necessary var w = this.autoWidth ? 0 : this.domNode.clientWidth || (this.domNode.offsetWidth - this._getPadBorder().w), vw = this.views.arrange(1, w); this.views.onEach("adaptWidth"); if (this.autoWidth) this.domNode.style.width = vw + "px"; }, adaptHeight: function(inHeaderHeight){ // private: measures and normalizes header height, then sets view heights, and then updates scroller // content extent var t = inHeaderHeight || this._getHeaderHeight(); var h = (this._autoHeight ? -1 : Math.max(this.domNode.clientHeight - t, 0) || 0); this.views.onEach('setSize', [0, h]); this.views.onEach('adaptHeight'); if(!this._autoHeight){ var numScroll = 0, numNoScroll = 0; var noScrolls = dojo.filter(this.views.views, function(v){ var has = v.hasHScrollbar(); if(has){ numScroll++; }else{ numNoScroll++; } return (!has); }); if(numScroll > 0 && numNoScroll > 0){ dojo.forEach(noScrolls, function(v){ v.adaptHeight(true); }); } } if(this.autoHeight === true || h != -1 || (typeof this.autoHeight == "number" && this.autoHeight >= this.attr('rowCount'))){ this.scroller.windowHeight = h; }else{ this.scroller.windowHeight = Math.max(this.domNode.clientHeight - t, 0); } }, // startup startup: function(){ if(this._started){return;} this.inherited(arguments); if(this.autoRender){ this.render(); } }, // render render: function(){ // summary: // Render the grid, headers, and views. Edit and scrolling states are reset. To retain edit and // scrolling states, see Update. if(!this.domNode){return;} if(!this._started){return;} if(!this.hasLayout()) { this.scroller.init(0, this.keepRows, this.rowsPerPage); return; } // this.update = this.defaultUpdate; this._render(); }, _render: function(){ this.scroller.init(this.attr('rowCount'), this.keepRows, this.rowsPerPage); this.prerender(); this.setScrollTop(0); this.postrender(); }, prerender: function(){ // if autoHeight, make sure scroller knows not to virtualize; everything must be rendered. this.keepRows = this._autoHeight ? 0 : this.keepRows; this.scroller.setKeepInfo(this.keepRows); this.views.render(); this._resize(); }, postrender: function(){ this.postresize(); this.focus.initFocusView(); // make rows unselectable dojo.setSelectable(this.domNode, this.selectable); }, postresize: function(){ // views are position absolute, so they do not inflate the parent if(this._autoHeight){ var size = Math.max(this.views.measureContent()) + 'px'; this.viewsNode.style.height = size; } }, renderRow: function(inRowIndex, inNodes){ // summary: private, used internally to render rows this.views.renderRow(inRowIndex, inNodes); }, rowRemoved: function(inRowIndex){ // summary: private, used internally to remove rows this.views.rowRemoved(inRowIndex); }, invalidated: null, updating: false, beginUpdate: function(){ // summary: // Use to make multiple changes to rows while queueing row updating. // NOTE: not currently supporting nested begin/endUpdate calls this.invalidated = []; this.updating = true; }, endUpdate: function(){ // summary: // Use after calling beginUpdate to render any changes made to rows. this.updating = false; var i = this.invalidated, r; if(i.all){ this.update(); }else if(i.rowCount != undefined){ this.updateRowCount(i.rowCount); }else{ for(r in i){ this.updateRow(Number(r)); } } this.invalidated = null; }, // update defaultUpdate: function(){ // note: initial update calls render and subsequently this function. if(!this.domNode){return;} if(this.updating){ this.invalidated.all = true; return; } //this.edit.saveState(inRowIndex); var lastScrollTop = this.scrollTop; this.prerender(); this.scroller.invalidateNodes(); this.setScrollTop(lastScrollTop); this.postrender(); //this.edit.restoreState(inRowIndex);";s:7:"summary";s:0:"";}s:23:"dojox.grid._Grid.update";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:8:"instance";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:17:" this.render();";s:7:"summary";s:53:"Update the grid, retaining edit and scrolling states.";}s:26:"dojox.grid._Grid.updateRow";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inRowIndex";a:2:{s:4:"type";s:7:"Integer";s:7:"summary";s:26:"Index of the row to render";}}s:6:"source";s:197:" inRowIndex = Number(inRowIndex); if(this.updating){ this.invalidated[inRowIndex]=true; }else{ this.views.updateRow(inRowIndex); this.scroller.rowHeightChanged(inRowIndex); }";s:7:"summary";s:20:"Render a single row.";}s:27:"dojox.grid._Grid.updateRows";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:10:"startIndex";a:2:{s:4:"type";s:7:"Integer";s:7:"summary";s:35:"Index of the starting row to render";}s:7:"howMany";a:2:{s:4:"type";s:7:"Integer";s:7:"summary";s:24:"How many rows to update.";}}s:6:"source";s:313:" startIndex = Number(startIndex); howMany = Number(howMany); if(this.updating){ for(var i=0; i this.scrollRedrawThreshold || this.delayScroll){ this.delayScroll = true; this.scrollTop = inTop; this.views.setScrollTop(inTop); jobs.job('dojoxGridScroll', 200, dojo.hitch(this, "finishScrollJob")); }else{ this.setScrollTop(inTop); }";s:7:"summary";s:52:"Vertically scroll the grid to a given pixel position";}s:32:"dojox.grid._Grid.finishScrollJob";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:66:" this.delayScroll = false; this.setScrollTop(this.scrollTop);";s:7:"summary";s:0:"";}s:29:"dojox.grid._Grid.setScrollTop";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"inTop";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:56:" this.scroller.scroll(this.views.setScrollTop(inTop));";s:7:"summary";s:0:"";}s:28:"dojox.grid._Grid.scrollToRow";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inRowIndex";a:2:{s:4:"type";s:7:"Integer";s:7:"summary";s:14:"grid row index";}}s:6:"source";s:66:" this.setScrollTop(this.scroller.findScrollTop(inRowIndex) + 1);";s:7:"summary";s:34:"Scroll the grid to a specific row.";}s:29:"dojox.grid._Grid.styleRowNode";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:10:"inRowIndex";a:1:{s:4:"type";s:0:"";}s:9:"inRowNode";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:73:" if(inRowNode){ this.rows.styleRowNode(inRowIndex, inRowNode); }";s:7:"summary";s:0:"";}s:26:"dojox.grid._Grid._mouseOut";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:28:" this.rows.setOverRow(-2);";s:7:"private";b:1;s:7:"summary";s:0:"";}s:24:"dojox.grid._Grid.getCell";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"inIndex";a:2:{s:4:"type";s:7:"Integer";s:7:"summary";s:37:"Grid column index of cell to retrieve";}}s:6:"source";s:37:" return this.layout.cells[inIndex];";s:7:"summary";s:50:"Retrieves the cell object for a given grid column.";s:14:"return_summary";s:11:"a grid cell";}s:29:"dojox.grid._Grid.setCellWidth";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:7:"inIndex";a:1:{s:4:"type";s:0:"";}s:11:"inUnitWidth";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:49:" this.getCell(inIndex).unitWidth = inUnitWidth;";s:7:"summary";s:0:"";}s:28:"dojox.grid._Grid.getCellName";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:6:"inCell";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:43:" return "Cell " + inCell.index; // String";s:7:"summary";s:38:"Returns the cell name of a passed cell";s:7:"returns";s:6:"String";}s:24:"dojox.grid._Grid.canSort";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inSortInfo";a:2:{s:4:"type";s:7:"Integer";s:7:"summary";s:125:"Sort information, 1-based index of column on which to sort, positive for an ascending sort and negative for a descending sort";}}s:6:"source";s:325:" // summary: // Determines if the grid can be sorted // inSortInfo: Integer // Sort information, 1-based index of column on which to sort, positive for an ascending sort // and negative for a descending sort // returns: Boolean // True if grid can be sorted on the given column in the given direction";s:7:"summary";s:36:"Determines if the grid can be sorted";s:14:"return_summary";s:77:"Boolean True if grid can be sorted on the given column in the given direction";}s:21:"dojox.grid._Grid.sort";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:0:"";s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.getSortAsc";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inSortInfo";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:115:" inSortInfo = inSortInfo == undefined ? this.sortInfo : inSortInfo; return Boolean(inSortInfo > 0); // Boolean";s:7:"summary";s:57:"Returns true if grid is sorted in an ascending direction.";s:7:"returns";s:7:"Boolean";}s:29:"dojox.grid._Grid.getSortIndex";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inSortInfo";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:116:" inSortInfo = inSortInfo == undefined ? this.sortInfo : inSortInfo; return Math.abs(inSortInfo) - 1; // Integer";s:7:"summary";s:59:"Returns the index of the column on which the grid is sorted";s:7:"returns";s:7:"Integer";}s:29:"dojox.grid._Grid.setSortIndex";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:7:"inIndex";a:2:{s:4:"type";s:7:"Integer";s:7:"summary";s:30:"Column index on which to sort.";}s:5:"inAsc";a:2:{s:4:"type";s:7:"Boolean";s:7:"summary";s:72:"If true, sort the grid in ascending order, otherwise in descending order";}}s:6:"source";s:179:" var si = inIndex +1; if(inAsc != undefined){ si *= (inAsc ? 1 : -1); } else if(this.getSortIndex() == inIndex){ si = -this.sortInfo; } this.setSortInfo(si);";s:7:"summary";s:50:"Sort the grid on a column in a specified direction";}s:28:"dojox.grid._Grid.setSortInfo";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inSortInfo";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:105:" if(this.canSort(inSortInfo)){ this.sortInfo = inSortInfo; this.sort(); this.update(); }";s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.doKeyEvent";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:53:" e.dispatch = 'do' + e.type; this.onKeyEvent(e);";s:7:"summary";s:0:"";}s:26:"dojox.grid._Grid._dispatch";a:6:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:1:"m";a:1:{s:4:"type";s:0:"";}s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:45:" if(m in this){ return this[m](e); }";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.grid._Grid.dispatchKeyEvent";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:33:" this._dispatch(e.dispatch, e);";s:7:"summary";s:0:"";}s:37:"dojox.grid._Grid.dispatchContentEvent";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:103:" this.edit.dispatchEvent(e) || e.sourceView.dispatchContentEvent(e) || this._dispatch(e.dispatch, e);";s:7:"summary";s:0:"";}s:36:"dojox.grid._Grid.dispatchHeaderEvent";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:81:" e.sourceView.dispatchHeaderEvent(e) || this._dispatch('doheader' + e.type, e);";s:7:"summary";s:0:"";}s:26:"dojox.grid._Grid.dokeydown";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:21:" this.onKeyDown(e);";s:7:"summary";s:0:"";}s:24:"dojox.grid._Grid.doclick";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:82:" if(e.cellNode){ this.onCellClick(e); }else{ this.onRowClick(e); }";s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid.dodblclick";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:88:" if(e.cellNode){ this.onCellDblClick(e); }else{ this.onRowDblClick(e); }";s:7:"summary";s:0:"";}s:30:"dojox.grid._Grid.docontextmenu";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:94:" if(e.cellNode){ this.onCellContextMenu(e); }else{ this.onRowContextMenu(e); }";s:7:"summary";s:0:"";}s:30:"dojox.grid._Grid.doheaderclick";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:91:" if(e.cellNode){ this.onHeaderCellClick(e); }else{ this.onHeaderClick(e); }";s:7:"summary";s:0:"";}s:33:"dojox.grid._Grid.doheaderdblclick";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:97:" if(e.cellNode){ this.onHeaderCellDblClick(e); }else{ this.onHeaderDblClick(e); }";s:7:"summary";s:0:"";}s:36:"dojox.grid._Grid.doheadercontextmenu";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:103:" if(e.cellNode){ this.onHeaderCellContextMenu(e); }else{ this.onHeaderContextMenu(e); }";s:7:"summary";s:0:"";}s:28:"dojox.grid._Grid.doStartEdit";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:6:"inCell";a:1:{s:4:"type";s:0:"";}s:10:"inRowIndex";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:40:" this.onStartEdit(inCell, inRowIndex);";s:7:"summary";s:0:"";}s:32:"dojox.grid._Grid.doApplyCellEdit";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:7:"inValue";a:1:{s:4:"type";s:0:"";}s:10:"inRowIndex";a:1:{s:4:"type";s:0:"";}s:12:"inFieldIndex";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:59:" this.onApplyCellEdit(inValue, inRowIndex, inFieldIndex);";s:7:"summary";s:0:"";}s:29:"dojox.grid._Grid.doCancelEdit";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inRowIndex";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:33:" this.onCancelEdit(inRowIndex);";s:7:"summary";s:0:"";}s:28:"dojox.grid._Grid.doApplyEdit";a:5:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:10:"inRowIndex";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:32:" this.onApplyEdit(inRowIndex);";s:7:"summary";s:0:"";}s:23:"dojox.grid._Grid.addRow";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:48:" this.updateRowCount(this.attr('rowCount')+1);";s:7:"summary";s:22:"Add a row to the grid.";}s:35:"dojox.grid._Grid.removeSelectedRows";a:4:{s:9:"prototype";s:16:"dojox.grid._Grid";s:4:"type";s:8:"Function";s:6:"source";s:124:" this.updateRowCount(Math.max(0, this.attr('rowCount') - this.selection.getSelected().length)); this.selection.clear();";s:7:"summary";s:39:"Remove the selected rows from the grid.";}s:33:"dojox.grid._Grid.domNode.tabIndex";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:33:"dojox.grid._Grid.domNode.onReveal";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:37:"dojox.grid._Grid.domNode.onSizeChange";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:28:"dojox.grid._Grid._autoHeight";a:3:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"private";b:1;s:7:"summary";s:0:"";}s:21:"dojox.grid._Grid.rows";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:22:"dojox.grid._Grid.focus";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:21:"dojox.grid._Grid.edit";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:26:"dojox.grid._Grid.selection";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:25:"dojox.grid._Grid.scroller";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:30:"dojox.grid._Grid.scroller.grid";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:39:"dojox.grid._Grid.scroller._pageIdPrefix";a:3:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"private";b:1;s:7:"summary";s:0:"";}s:35:"dojox.grid._Grid.scroller.renderRow";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:35:"dojox.grid._Grid.scroller.removeRow";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:23:"dojox.grid._Grid.layout";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:22:"dojox.grid._Grid.views";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:33:"dojox.grid._Grid.views.createView";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:39:"dojox.grid._Grid.messagesNode.innerHTML";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:43:"dojox.grid._Grid.messagesNode.style.display";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:27:"dojox.grid._Grid._padBorder";a:3:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"private";b:1;s:7:"summary";s:0:"";}s:37:"dojox.grid._Grid.domNode.style.height";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:39:"dojox.grid._Grid.viewsNode.style.height";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:22:"dojox.grid._Grid.fitTo";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:46:"dojox.grid._Grid.viewsHeaderNode.style.display";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:36:"dojox.grid._Grid.domNode.style.width";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:38:"dojox.grid._Grid.scroller.windowHeight";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:32:"dojox.grid._Grid.invalidated.all";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:37:"dojox.grid._Grid.invalidated.rowCount";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:30:"dojox.grid._Grid.lastScrollTop";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:26:"dojox.grid._Grid.scrollTop";a:2:{s:8:"instance";s:16:"dojox.grid._Grid";s:7:"summary";s:0:"";}s:20:"dojox.grid.__CellDef";a:5:{s:4:"type";s:8:"Function";s:6:"source";s:3780:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs;";s:7:"private";b:1;s:9:"classlike";b:1;s:7:"summary";s:0:"";}s:25:"dojox.grid.__CellDef.name";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:7:"String?";s:7:"summary";s:56:"The text to use in the header of the grid for this cell.";s:14:"private_parent";b:1;}s:26:"dojox.grid.__CellDef.value";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:7:"String?";s:7:"summary";s:333:"If "get" is not specified, this is used as the data for the cell. defaultValue: String? If "get" and "value" aren't specified or if "get" returns an undefined value, this is used as the data for the cell. "formatter" is not run on this if "get" returns an undefined value.";s:14:"private_parent";b:1;}s:24:"dojox.grid.__CellDef.get";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:9:"Function?";s:7:"summary";s:150:"function(rowIndex){} rowIndex is of type Integer. This function will be called when a cell requests data. Returns the unformatted data for the cell.";s:14:"private_parent";b:1;}s:30:"dojox.grid.__CellDef.formatter";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:9:"Function?";s:7:"summary";s:241:"function(data, rowIndex){} data is of type anything, rowIndex is of type Integer. This function will be called after the cell has its data but before it passes it back to the grid to render. Returns the formatted version of the cell's data.";s:14:"private_parent";b:1;}s:25:"dojox.grid.__CellDef.type";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:32:"dojox.grid.cells._Base|Function?";s:7:"summary";s:4:"TODO";s:14:"private_parent";b:1;}s:29:"dojox.grid.__CellDef.editable";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:8:"Boolean?";s:7:"summary";s:44:"Whether this cell should be editable or not.";s:14:"private_parent";b:1;}s:27:"dojox.grid.__CellDef.hidden";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:8:"Boolean?";s:7:"summary";s:109:"If true, the cell will not be displayed. noresize: Boolean? If true, the cell will not be able to be resized.";s:14:"private_parent";b:1;}s:26:"dojox.grid.__CellDef.width";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:15:"Integer|String?";s:7:"summary";s:59:"A CSS size. If it's an Integer, the width will be in em's.";s:14:"private_parent";b:1;}s:28:"dojox.grid.__CellDef.colSpan";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:8:"Integer?";s:7:"summary";s:81:"How many columns to span this cell. Will not work in the first sub-row of cells.";s:14:"private_parent";b:1;}s:28:"dojox.grid.__CellDef.rowSpan";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:8:"Integer?";s:7:"summary";s:36:"How many sub-rows to span this cell.";s:14:"private_parent";b:1;}s:27:"dojox.grid.__CellDef.styles";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:7:"String?";s:7:"summary";s:92:"A string of styles to apply to both the header cell and main grid cells. Must end in a ';'.";s:14:"private_parent";b:1;}s:33:"dojox.grid.__CellDef.headerStyles";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:7:"String?";s:7:"summary";s:71:"A string of styles to apply to just the header cell. Must end in a ';'";s:14:"private_parent";b:1;}s:31:"dojox.grid.__CellDef.cellStyles";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:7:"String?";s:7:"summary";s:75:"A string of styles to apply to just the main grid cells. Must end in a ';'";s:14:"private_parent";b:1;}s:28:"dojox.grid.__CellDef.classes";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:7:"String?";s:7:"summary";s:91:"A space separated list of classes to apply to both the header cell and the main grid cells.";s:14:"private_parent";b:1;}s:34:"dojox.grid.__CellDef.headerClasses";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:7:"String?";s:7:"summary";s:67:"A space separated list of classes to apply to just the header cell.";s:14:"private_parent";b:1;}s:32:"dojox.grid.__CellDef.cellClasses";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:7:"String?";s:7:"summary";s:71:"A space separated list of classes to apply to just the main grid cells.";s:14:"private_parent";b:1;}s:26:"dojox.grid.__CellDef.attrs";a:4:{s:8:"instance";s:20:"dojox.grid.__CellDef";s:4:"type";s:7:"String?";s:7:"summary";s:114:"A space separated string of attribute='value' pairs to add to the header cell element and main grid cell elements.";s:14:"private_parent";b:1;}s:20:"dojox.grid.__ViewDef";a:5:{s:4:"type";s:8:"Function";s:6:"source";s:5694:"dojo.provide("dojox.grid._Grid"); dojo.require("dijit.dijit"); dojo.require("dijit.Menu"); dojo.require("dojox.html.metrics"); dojo.require("dojox.grid.util"); dojo.require("dojox.grid._Scroller"); dojo.require("dojox.grid._Layout"); dojo.require("dojox.grid._View"); dojo.require("dojox.grid._ViewManager"); dojo.require("dojox.grid._RowManager"); dojo.require("dojox.grid._FocusManager"); dojo.require("dojox.grid._EditManager"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RowSelector"); dojo.require("dojox.grid._Events"); dojo.requireLocalization("dijit", "loading"); (function(){ var jobs = { cancel: function(inHandle){ if(inHandle){ clearTimeout(inHandle); } }, jobs: [], job: function(inName, inDelay, inJob){ jobs.cancelJob(inName); var job = function(){ delete jobs.jobs[inName]; inJob(); } jobs.jobs[inName] = setTimeout(job, inDelay); }, cancelJob: function(inName){ jobs.cancel(jobs.jobs[inName]); } }; dojox.grid.__CellDef = function(){ // name: String? // The text to use in the header of the grid for this cell. // get: Function? // function(rowIndex){} rowIndex is of type Integer. This // function will be called when a cell requests data. Returns the // unformatted data for the cell. // value: String? // If "get" is not specified, this is used as the data for the cell. // defaultValue: String? // If "get" and "value" aren't specified or if "get" returns an undefined // value, this is used as the data for the cell. "formatter" is not run // on this if "get" returns an undefined value. // formatter: Function? // function(data, rowIndex){} data is of type anything, rowIndex // is of type Integer. This function will be called after the cell // has its data but before it passes it back to the grid to render. // Returns the formatted version of the cell's data. // type: dojox.grid.cells._Base|Function? // TODO // editable: Boolean? // Whether this cell should be editable or not. // hidden: Boolean? // If true, the cell will not be displayed. // noresize: Boolean? // If true, the cell will not be able to be resized. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. // colSpan: Integer? // How many columns to span this cell. Will not work in the first // sub-row of cells. // rowSpan: Integer? // How many sub-rows to span this cell. // styles: String? // A string of styles to apply to both the header cell and main // grid cells. Must end in a ';'. // headerStyles: String? // A string of styles to apply to just the header cell. Must end // in a ';' // cellStyles: String? // A string of styles to apply to just the main grid cells. Must // end in a ';' // classes: String? // A space separated list of classes to apply to both the header // cell and the main grid cells. // headerClasses: String? // A space separated list of classes to apply to just the header // cell. // cellClasses: String? // A space separated list of classes to apply to just the main // grid cells. // attrs: String? // A space separated string of attribute='value' pairs to add to // the header cell element and main grid cell elements. this.name = name; this.value = value; this.get = get; this.formatter = formatter; this.type = type; this.editable = editable; this.hidden = hidden; this.width = width; this.colSpan = colSpan; this.rowSpan = rowSpan; this.styles = styles; this.headerStyles = headerStyles; this.cellStyles = cellStyles; this.classes = classes; this.headerClasses = headerClasses; this.cellClasses = cellClasses; this.attrs = attrs; } dojox.grid.__ViewDef = function(){ // noscroll: Boolean? // If true, no scrollbars will be rendered without scrollbars. // width: Integer|String? // A CSS size. If it's an Integer, the width will be in em's. If // "noscroll" is true, this value is ignored. // cells: dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]? // The structure of the cells within this grid. // type: String? // A string containing the constructor of a subclass of // dojox.grid._View. If this is not specified, dojox.grid._View // is used. // defaultCell: dojox.grid.__CellDef? // A cell definition with default values for all cells in this view. If // a property is defined in a cell definition in the "cells" array and // this property, the cell definition's property will override this // property's property. // onBeforeRow: Function? // function(rowIndex, cells){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]]. This function is called // before each row of data is rendered. Before the header is // rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. // onAfterRow: Function? // function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells // is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. // This function is called after each row of data is rendered. After the // header is rendered, rowIndex will be -1. "cells" is a reference to the // internal structure of this view's cells so any changes you make to // it will persist between calls. this.noscroll = noscroll; this.width = width; this.cells = cells; this.type = type; this.defaultCell = defaultCell; this.onBeforeRow = onBeforeRow; this.onAfterRow = onAfterRow;";s:7:"private";b:1;s:9:"classlike";b:1;s:7:"summary";s:0:"";}s:29:"dojox.grid.__ViewDef.noscroll";a:4:{s:8:"instance";s:20:"dojox.grid.__ViewDef";s:4:"type";s:8:"Boolean?";s:7:"summary";s:59:"If true, no scrollbars will be rendered without scrollbars.";s:14:"private_parent";b:1;}s:26:"dojox.grid.__ViewDef.width";a:4:{s:8:"instance";s:20:"dojox.grid.__ViewDef";s:4:"type";s:15:"Integer|String?";s:7:"summary";s:115:"A CSS size. If it's an Integer, the width will be in em's. If "noscroll" is true, this value is ignored.";s:14:"private_parent";b:1;}s:26:"dojox.grid.__ViewDef.cells";a:4:{s:8:"instance";s:20:"dojox.grid.__ViewDef";s:4:"type";s:53:"dojox.grid.__CellDef[]|Array[dojox.grid.__CellDef[]]?";s:7:"summary";s:44:"The structure of the cells within this grid.";s:14:"private_parent";b:1;}s:25:"dojox.grid.__ViewDef.type";a:4:{s:8:"instance";s:20:"dojox.grid.__ViewDef";s:4:"type";s:7:"String?";s:7:"summary";s:123:"A string containing the constructor of a subclass of dojox.grid._View. If this is not specified, dojox.grid._View is used.";s:14:"private_parent";b:1;}s:32:"dojox.grid.__ViewDef.defaultCell";a:4:{s:8:"instance";s:20:"dojox.grid.__ViewDef";s:4:"type";s:21:"dojox.grid.__CellDef?";s:7:"summary";s:233:"A cell definition with default values for all cells in this view. If a property is defined in a cell definition in the "cells" array and this property, the cell definition's property will override this property's property.";s:14:"private_parent";b:1;}s:32:"dojox.grid.__ViewDef.onBeforeRow";a:4:{s:8:"instance";s:20:"dojox.grid.__ViewDef";s:4:"type";s:9:"Function?";s:7:"summary";s:358:"function(rowIndex, cells){} rowIndex is of type Integer, cells is of type Array[dojox.grid.__CellDef[]]. This function is called before each row of data is rendered. Before the header is rendered, rowIndex will be -1. "cells" is a reference to the internal structure of this view's cells so any changes you make to it will persist between calls.";s:14:"private_parent";b:1;}s:31:"dojox.grid.__ViewDef.onAfterRow";a:4:{s:8:"instance";s:20:"dojox.grid.__ViewDef";s:4:"type";s:9:"Function?";s:7:"summary";s:392:"function(rowIndex, cells, rowNode){} rowIndex is of type Integer, cells is of type Array[dojox.grid.__CellDef[]], rowNode is of type DOMNode. This function is called after each row of data is rendered. After the header is rendered, rowIndex will be -1. "cells" is a reference to the internal structure of this view's cells so any changes you make to it will persist between calls.";s:14:"private_parent";b:1;}s:30:"dojox.grid._Grid.markupFactory";a:5:{s:4:"type";s:8:"Function";s:10:"parameters";a:4:{s:5:"props";a:1:{s:4:"type";s:0:"";}s:4:"node";a:1:{s:4:"type";s:0:"";}s:4:"ctor";a:1:{s:4:"type";s:0:"";}s:8:"cellFunc";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:3051:" var d = dojo; var widthFromAttr = function(n){ var w = d.attr(n, "width")||"auto"; if((w != "auto")&&(w.slice(-2) != "em")&&(w.slice(-1) != "%")){ w = parseInt(w)+"px"; } return w; } // if(!props.store){ console.debug("no store!"); } // if a structure isn't referenced, do we have enough // data to try to build one automatically? if( !props.structure && node.nodeName.toLowerCase() == "table"){ // try to discover a structure props.structure = d.query("> colgroup", node).map(function(cg){ var sv = d.attr(cg, "span"); var v = { noscroll: (d.attr(cg, "noscroll") == "true") ? true : false, __span: (!!sv ? parseInt(sv) : 1), cells: [] }; if(d.hasAttr(cg, "width")){ v.width = widthFromAttr(cg); } return v; // for vendetta }); if(!props.structure.length){ props.structure.push({ __span: Infinity, cells: [] // catch-all view }); } // check to see if we're gonna have more than one view // for each tr in our th, create a row of cells d.query("thead > tr", node).forEach(function(tr, tr_idx){ var cellCount = 0; var viewIdx = 0; var lastViewIdx; var cView = null; d.query("> th", tr).map(function(th){ // what view will this cell go into? // NOTE: // to prevent extraneous iteration, we start counters over // for each row, incrementing over the surface area of the // structure that colgroup processing generates and // creating cell objects for each to place into those // cell groups. There's a lot of state-keepking logic // here, but it is what it has to be. if(!cView){ // current view book keeping lastViewIdx = 0; cView = props.structure[0]; }else if(cellCount >= (lastViewIdx+cView.__span)){ viewIdx++; // move to allocating things into the next view lastViewIdx += cView.__span; var lastView = cView; cView = props.structure[viewIdx]; } // actually define the cell from what markup hands us var cell = { name: d.trim(d.attr(th, "name")||th.innerHTML), colSpan: parseInt(d.attr(th, "colspan")||1, 10), type: d.trim(d.attr(th, "cellType")||"") }; cellCount += cell.colSpan; var rowSpan = d.attr(th, "rowspan"); if(rowSpan){ cell.rowSpan = rowSpan; } if(d.hasAttr(th, "width")){ cell.width = widthFromAttr(th); } if(d.hasAttr(th, "relWidth")){ cell.relWidth = window.parseInt(dojo.attr(th, "relWidth"), 10); } if(d.hasAttr(th, "hidden")){ cell.hidden = d.attr(th, "hidden") == "true"; } if(cellFunc){ cellFunc(th, cell); } cell.type = cell.type ? dojo.getObject(cell.type) : dojox.grid.cells.Cell; if(cell.type && cell.type.markupFactory){ cell.type.markupFactory(th, cell); } if(!cView.cells[tr_idx]){ cView.cells[tr_idx] = []; } cView.cells[tr_idx].push(cell); }); }); } return new ctor(props, node);";s:7:"returns";s:12:"for vendetta";s:7:"summary";s:0:"";}s:10:"dojox.grid";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}