a:41:{s:9:"#provides";s:22:"dojox.grid.compat.Grid";s:9:"#resource";s:19:"grid/compat/Grid.js";s:9:"#requires";a:4:{i:0;a:2:{i:0;s:6:"common";i:1;s:29:"dojox.grid.compat.VirtualGrid";}i:1;a:2:{i:0;s:6:"common";i:1;s:29:"dojox.grid.compat._data.model";}i:2;a:2:{i:0;s:6:"common";i:1;s:31:"dojox.grid.compat._data.editors";}i:3;a:2:{i:0;s:6:"common";i:1;s:36:"dojox.grid.compat._data.dijitEditors";}}s:10:"dojox.Grid";a:6:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:17:"dojox.VirtualGrid";}s:4:"call";a:1:{i:0;s:17:"dojox.VirtualGrid";}}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:69:"Grid is a subclass of VirtualGrid, providing binding to a data
store.";s:8:"examples";a:1:{i:0;s:411:"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: formatFunction }
]
]}
];
define a grid data model
var model = new dojox.grid.data.table(null, data);
";}s:9:"classlike";b:1;}s:16:"dojox.Grid.model";a:4:{s:9:"prototype";s:10:"dojox.Grid";s:8:"instance";s:10:"dojox.Grid";s:4:"type";s:6:"string";s:7:"summary";s:25:"or object grid data model";}s:21:"dojox.Grid.postCreate";a:4:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:6:"source";s:213:" if(this.model){
var m = this.model;
if(dojo.isString(m)){
m = dojo.getObject(m);
}
this.model = (dojo.isFunction(m)) ? new m() : m;
this._setModel(this.model);
}
this.inherited(arguments);";s:7:"summary";s:0:"";}s:18:"dojox.Grid.destroy";a:4:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:6:"source";s:51:" this.setModel(null);
this.inherited(arguments);";s:7:"summary";s:0:"";}s:28:"dojox.Grid._structureChanged";a:5:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:6:"source";s:54:" this.indexCellFields();
this.inherited(arguments);";s:7:"private";b:1;s:7:"summary";s:0:"";}s:20:"dojox.Grid._setModel";a:6:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"inModel";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:1811:"dojo.provide("dojox.grid.compat.Grid");
dojo.require("dojox.grid.compat.VirtualGrid");
dojo.require("dojox.grid.compat._data.model");
dojo.require("dojox.grid.compat._data.editors");
dojo.require("dojox.grid.compat._data.dijitEditors");
// FIXME:
// we are at the wrong location!
dojo.declare('dojox.Grid', dojox.VirtualGrid, {
// summary:
// A grid widget with virtual scrolling, cell editing, complex rows,
// sorting, fixed columns, sizeable columns, etc.
// description:
// Grid is a subclass of VirtualGrid, providing binding to a data
// store.
// example:
// 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: formatFunction }
// | ]
// | ]}
// | ];
//
// define a grid data model
// | var model = new dojox.grid.data.table(null, data);
// |
// |
//
// model:
// string or object grid data model
model: 'dojox.grid.data.Table',
// life cycle
postCreate: function(){
if(this.model){
var m = this.model;
if(dojo.isString(m)){
m = dojo.getObject(m);
}
this.model = (dojo.isFunction(m)) ? new m() : m;
this._setModel(this.model);
}
this.inherited(arguments);
},
destroy: function(){
this.setModel(null);
this.inherited(arguments);
},
// structure
_structureChanged: function() {
this.indexCellFields();
this.inherited(arguments);
},
// model
_setModel: function(inModel){
// if(!inModel){ return; }
this.model = inModel;
if(this.model){
this.model.observer(this);
this.model.measure();
this.indexCellFields();
}";s:7:"private";b:1;s:7:"summary";s:0:"";}s:19:"dojox.Grid.setModel";a:5:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"inModel";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:69:"Model object, usually an instance of a dojox.grid.data.Model
subclass";}}s:6:"source";s:81:" if(this.model){
this.model.notObserver(this);
}
this._setModel(inModel);";s:7:"summary";s:25:"Set the grid's data model";}s:14:"dojox.Grid.get";a:5:{s:9:"prototype";s:10:"dojox.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:63:" return this.grid.model.getDatum(inRowIndex, this.fieldIndex);";s:7:"summary";s:38:"data socket (called in cell's context)";}s:25:"dojox.Grid.modelAllChange";a:4:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:6:"source";s:100:" this.rowCount = (this.model ? this.model.getRowCount() : 0);
this.updateRowCount(this.rowCount);";s:7:"summary";s:0:"";}s:27:"dojox.Grid.modelBeginUpdate";a:4:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:6:"source";s:21:" this.beginUpdate();";s:7:"summary";s:0:"";}s:25:"dojox.Grid.modelEndUpdate";a:4:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:6:"source";s:19:" this.endUpdate();";s:7:"summary";s:0:"";}s:25:"dojox.Grid.modelRowChange";a:5:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:6:"inData";a:1:{s:4:"type";s:0:"";}s:10:"inRowIndex";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:29:" this.updateRow(inRowIndex);";s:7:"summary";s:0:"";}s:27:"dojox.Grid.modelDatumChange";a:5:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:7:"inDatum";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:29:" this.updateRow(inRowIndex);";s:7:"summary";s:0:"";}s:28:"dojox.Grid.modelFieldsChange";a:4:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:6:"source";s:42:" this.indexCellFields();
this.render();";s:7:"summary";s:0:"";}s:25:"dojox.Grid.modelInsertion";a:5:{s:9:"prototype";s:10:"dojox.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:48:" this.updateRowCount(this.model.getRowCount());";s:7:"summary";s:0:"";}s:23:"dojox.Grid.modelRemoval";a:5:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:6:"inKeys";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:48:" this.updateRowCount(this.model.getRowCount());";s:7:"summary";s:0:"";}s:22:"dojox.Grid.getCellName";a:5:{s:9:"prototype";s:10:"dojox.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:129:" var v = this.model.fields.values, i = inCell.fieldIndex;
return i>=0 && i 0 ? 1 : -1);";s:7:"summary";s:48:"Retrieves the model field on which to sort data.";}s:15:"dojox.Grid.sort";a:5:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:6:"source";s:60:" this.edit.apply();
this.model.sort(this.getSortField());";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:9:"this.edit";}}s:7:"summary";s:0:"";}s:17:"dojox.Grid.addRow";a:6:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:9:"inRowData";a:1:{s:4:"type";s:0:"";}s:7:"inIndex";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:453:" this.edit.apply();
var i = inIndex || -1;
if(i<0){
i = this.selection.getFirstSelected() || 0;
}
if(i<0){
i = 0;
}
this.model.insert(inRowData, i);
this.model.beginModifyRow(i);
// begin editing row
// FIXME: add to edit
for(var j=0, c; ((c=this.getCell(j)) && !c.editor); j++){}
if(c&&c.editor){
this.edit.setEditCell(c, i);
this.focus.setFocusCell(c, i);
}else{
this.focus.setFocusCell(this.getCell(0), i);
}";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:9:"this.edit";}}s:7:"summary";s:0:"";}s:29:"dojox.Grid.removeSelectedRows";a:5:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:6:"source";s:132:" this.edit.apply();
var s = this.selection.getSelected();
if(s.length){
this.model.remove(s);
this.selection.clear();
}";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:9:"this.edit";}}s:7:"summary";s:0:"";}s:18:"dojox.Grid.canEdit";a:6:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:6:"inCell";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:11:"A grid cell";}s:10:"inRowIndex";a:2:{s:4:"type";s:7:"Integer";s:7:"summary";s:14:"Grid row index";}}s:6:"source";s:74:" return (this.model.canModify ? this.model.canModify(inRowIndex) : true);";s:7:"summary";s:40:"Determines if a given cell may be edited";s:14:"return_summary";s:40:"Boolean
True if given cell may be edited";}s:22:"dojox.Grid.doStartEdit";a:5:{s:9:"prototype";s:10:"dojox.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:80:" this.model.beginModifyRow(inRowIndex);
this.onStartEdit(inCell, inRowIndex);";s:7:"summary";s:0:"";}s:26:"dojox.Grid.doApplyCellEdit";a:5:{s:9:"prototype";s:10:"dojox.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:116:" this.model.setDatum(inValue, inRowIndex, inFieldIndex);
this.onApplyCellEdit(inValue, inRowIndex, inFieldIndex);";s:7:"summary";s:0:"";}s:23:"dojox.Grid.doCancelEdit";a:6:{s:9:"prototype";s:10:"dojox.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:85:" this.model.cancelModifyRow(inRowIndex);
this.onCancelEdit.apply(this, arguments);";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:17:"this.onCancelEdit";}}s:7:"summary";s:0:"";}s:22:"dojox.Grid.doApplyEdit";a:5:{s:9:"prototype";s:10:"dojox.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:70:" this.model.endModifyRow(inRowIndex);
this.onApplyEdit(inRowIndex);";s:7:"summary";s:0:"";}s:24:"dojox.Grid.styleRowState";a:5:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"inRow";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:260:" if(this.model.getState){
var states=this.model.getState(inRow.index), c='';
for(var i=0, ss=["inflight", "error", "inserting"], s; s=ss[i]; i++){
if(states[s]){
c = ' dojoxGrid-row-' + s;
break;
}
}
inRow.customClasses += c;
}";s:7:"summary";s:19:"Perform row styling";}s:21:"dojox.Grid.onStyleRow";a:5:{s:9:"prototype";s:10:"dojox.Grid";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"inRow";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:57:" this.styleRowState(inRow);
this.inherited(arguments);";s:7:"summary";s:0:"";}s:19:"dojox.Grid.rowCount";a:2:{s:8:"instance";s:10:"dojox.Grid";s:7:"summary";s:0:"";}s:24:"dojox.Grid.markupFactory";a:5:{s:4:"type";s:8:"Function";s:10:"parameters";a:3:{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:6:"source";s:9762:"dojo.provide("dojox.grid.compat.Grid");
dojo.require("dojox.grid.compat.VirtualGrid");
dojo.require("dojox.grid.compat._data.model");
dojo.require("dojox.grid.compat._data.editors");
dojo.require("dojox.grid.compat._data.dijitEditors");
// FIXME:
// we are at the wrong location!
dojo.declare('dojox.Grid', dojox.VirtualGrid, {
// summary:
// A grid widget with virtual scrolling, cell editing, complex rows,
// sorting, fixed columns, sizeable columns, etc.
// description:
// Grid is a subclass of VirtualGrid, providing binding to a data
// store.
// example:
// 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: formatFunction }
// | ]
// | ]}
// | ];
//
// define a grid data model
// | var model = new dojox.grid.data.table(null, data);
// |
// |
//
// model:
// string or object grid data model
model: 'dojox.grid.data.Table',
// life cycle
postCreate: function(){
if(this.model){
var m = this.model;
if(dojo.isString(m)){
m = dojo.getObject(m);
}
this.model = (dojo.isFunction(m)) ? new m() : m;
this._setModel(this.model);
}
this.inherited(arguments);
},
destroy: function(){
this.setModel(null);
this.inherited(arguments);
},
// structure
_structureChanged: function() {
this.indexCellFields();
this.inherited(arguments);
},
// model
_setModel: function(inModel){
// if(!inModel){ return; }
this.model = inModel;
if(this.model){
this.model.observer(this);
this.model.measure();
this.indexCellFields();
}
},
setModel: function(inModel){
// summary:
// Set the grid's data model
// inModel: Object
// Model object, usually an instance of a dojox.grid.data.Model
// subclass
if(this.model){
this.model.notObserver(this);
}
this._setModel(inModel);
},
get: function(inRowIndex){
// summary: data socket (called in cell's context)
return this.grid.model.getDatum(inRowIndex, this.fieldIndex);
},
// model modifications
modelAllChange: function(){
this.rowCount = (this.model ? this.model.getRowCount() : 0);
this.updateRowCount(this.rowCount);
},
modelBeginUpdate: function(){
this.beginUpdate();
},
modelEndUpdate: function(){
this.endUpdate();
},
modelRowChange: function(inData, inRowIndex){
this.updateRow(inRowIndex);
},
modelDatumChange: function(inDatum, inRowIndex, inFieldIndex){
this.updateRow(inRowIndex);
},
modelFieldsChange: function() {
this.indexCellFields();
this.render();
},
// model insertion
modelInsertion: function(inRowIndex){
this.updateRowCount(this.model.getRowCount());
},
// model removal
modelRemoval: function(inKeys){
this.updateRowCount(this.model.getRowCount());
},
// cells
getCellName: function(inCell){
var v = this.model.fields.values, i = inCell.fieldIndex;
return i>=0 && i 0 ? 1 : -1);
},
sort: function(){
this.edit.apply();
this.model.sort(this.getSortField());
},
// row editing
addRow: function(inRowData, inIndex){
this.edit.apply();
var i = inIndex || -1;
if(i<0){
i = this.selection.getFirstSelected() || 0;
}
if(i<0){
i = 0;
}
this.model.insert(inRowData, i);
this.model.beginModifyRow(i);
// begin editing row
// FIXME: add to edit
for(var j=0, c; ((c=this.getCell(j)) && !c.editor); j++){}
if(c&&c.editor){
this.edit.setEditCell(c, i);
this.focus.setFocusCell(c, i);
}else{
this.focus.setFocusCell(this.getCell(0), i);
}
},
removeSelectedRows: function(){
this.edit.apply();
var s = this.selection.getSelected();
if(s.length){
this.model.remove(s);
this.selection.clear();
}
},
//: protected
// editing
canEdit: function(inCell, inRowIndex){
// summary:
// Determines if a given cell may be edited
// inCell: Object
// A grid cell
// inRowIndex: Integer
// Grid row index
// returns: Boolean
// True if given cell may be edited
return (this.model.canModify ? this.model.canModify(inRowIndex) : true);
},
doStartEdit: function(inCell, inRowIndex){
this.model.beginModifyRow(inRowIndex);
this.onStartEdit(inCell, inRowIndex);
},
doApplyCellEdit: function(inValue, inRowIndex, inFieldIndex){
this.model.setDatum(inValue, inRowIndex, inFieldIndex);
this.onApplyCellEdit(inValue, inRowIndex, inFieldIndex);
},
doCancelEdit: function(inRowIndex){
this.model.cancelModifyRow(inRowIndex);
this.onCancelEdit.apply(this, arguments);
},
doApplyEdit: function(inRowIndex){
this.model.endModifyRow(inRowIndex);
this.onApplyEdit(inRowIndex);
},
styleRowState: function(inRow){
// summary: Perform row styling
if(this.model.getState){
var states=this.model.getState(inRow.index), c='';
for(var i=0, ss=["inflight", "error", "inserting"], s; s=ss[i]; i++){
if(states[s]){
c = ' dojoxGrid-row-' + s;
break;
}
}
inRow.customClasses += c;
}
},
onStyleRow: function(inRow){
this.styleRowState(inRow);
this.inherited(arguments);
}
});
dojox.Grid.markupFactory = function(props, node, ctor){
// handle setting up a data model for a store if one
// isn't provided. There are some caveats:
// * we only really handle dojo.data sources well. They're the future
// so it's no big deal, but it's something to be aware of.
// * I'm pretty sure that colgroup introspection is missing some of
// the available settable properties.
// * No handling of cell formatting and content getting is done
var d = dojo;
var widthFromAttr = function(n){
var w = d.attr(n, "width")||"auto";
if((w != "auto")&&(w.substr(-2) != "em")){
w = parseInt(w)+"px";
}
return w;
}
if(!props.model && d.hasAttr(node, "store")){
// if a model isn't specified and we point to a store, assume
// we're also folding the definition for a model up into the
// inline ctor for the Grid. This will then take properties
// like "query", "rowsPerPage", and "clientSort" from the grid
// definition.
var mNode = node.cloneNode(false);
d.attr(mNode, {
"jsId": null,
"dojoType": d.attr(node, "dataModelClass") || "dojox.grid.data.DojoData"
});
props.model = d.parser.instantiate([mNode])[0];
}
// if(!props.model){ console.debug("no model!"); }
// 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),
field: d.trim(d.attr(th, "field")||""),
colSpan: parseInt(d.attr(th, "colspan")||1)
};
cellCount += cell.colSpan;
cell.field = cell.field||cell.name;
cell.width = widthFromAttr(th);
if(!cView.cells[tr_idx]){
cView.cells[tr_idx] = [];
}
cView.cells[tr_idx].push(cell);
});
});
// console.debug(dojo.toJson(props.structure, true));
}
return new dojox.Grid(props, node);";s:7:"returns";s:12:"for vendetta";s:7:"summary";s:0:"";}s:15:"dojox.grid.Grid";a:1:{s:7:"summary";s:0:"";}s:22:"dojox.grid.compat.Grid";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:17:"dojox.grid.compat";a:2:{s:4:"type";s:6:"Object";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:"";}} |