I am working through the EditableGrid demos modifying the code to understand it and reach a working example of multiple grids with the write-to-db example. I am a non-programmer and vba-hack.
Creating multiple grids in non-db examples is simple enough. However trying to replicate the code/structure for multiple grids I think prototype and this objects are might be confusing me
multiple grids without the db-link/inline-edit:
window.onload = function() {
editableGrid = new EditableGrid("DemoGridMinimal");
editableGrid.tableLoaded = function() { this.renderGrid("tablecontent", "testgrid"); };
editableGrid.loadXML("grid.xml");
editableGrid = new EditableGrid("DemoGridMinimal2");
editableGrid.tableLoaded = function() { this.renderGrid("tablecontent2", "testgrid"); };
editableGrid.loadXML("grid.xml");
}
single grid with the db link and inline edit: (a little modified from the example)
function DatabaseGrid() {
this.editableGrid = new EditableGrid("demo", {
enableSort: false,
tableLoaded: function() { datagrid.initializeGrid(this); },
modelChanged: function(rowIndex, columnIndex, oldValue, newValue, row) {
updateCellValue(this, rowIndex, columnIndex, oldValue, newValue, row);
}
});
this.fetchGrid();
}
DatabaseGrid.prototype.initializeGrid = function(grid) { grid.renderGrid("tablecontent", "testgrid"); };
DatabaseGrid.prototype.fetchGrid = function() { this.editableGrid.loadXML("loaddata.php"); };
window.onload = function() {
datagrid = new DatabaseGrid();
};
if it helps put overall context, the end result is to have several grids on a single page, populated with single sql query, defined by a html form input {accounting sql injection}, with each grid showing different fields from the db
could someone be kind enough to briefly explain the context of prototype and this in the example here