Oct 09, 2013, 6:16 AM
[CLOSED] Prototype wrapper for ext 2.x to support ext 1.x
Hi
We are facing many issues when migrating from Ext 1.x to 2.x, Especially in Javascript many methods have been moved / removed / updated.
Eg. In the grid panel, .addRecord method is removed and to acheive this functionality we need to use store.insert,
What we did is created a prototype for grid panel to make the old code work without changes. Please see below
We are facing many issues when migrating from Ext 1.x to 2.x, Especially in Javascript many methods have been moved / removed / updated.
Eg. In the grid panel, .addRecord method is removed and to acheive this functionality we need to use store.insert,
What we did is created a prototype for grid panel to make the old code work without changes. Please see below
var protoTypeSettings = { Grid: { EditOnAdd: false } };
Ext.grid.Panel.prototype.hello = function () { alert('hello'); }
Ext.grid.Panel.prototype.addRecord = function () {
var store = this.getStore();
var dataLength = store.data.length;
var model = new window[store.model.$className];
store.insert(dataLength, model);
var cellEditingPlugin = this.editingPlugin;
if (cellEditingPlugin != null && cellEditingPlugin != undefined && protoTypeSettings.Grid.EditOnAdd)
this.editingPlugin.startEdit(dataLength, 0);
return dataLength;
}
Ext.grid.Panel.prototype.startEditing = function (rowIndex, colIndex) {
var cellEditingPlugin = this.editingPlugin;
if (cellEditingPlugin != null && cellEditingPlugin != undefined)
this.editingPlugin.startEdit(rowIndex, colIndex);
}
It will be good if you provide a prototype for all the workarounds. This will make the migration process smooth,
Last edited by Daniil; Oct 15, 2013 at 6:41 AM.
Reason: [CLOSED]