PDA

View Full Version : [CLOSED] Prototype wrapper for ext 2.x to support ext 1.x



speedstepmem4
Oct 09, 2013, 6:16 AM
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



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,

Daniil
Oct 09, 2013, 8:16 AM
Hi @speedstepmem4,


It will be good if you provide a prototype for all the workarounds. This will make the migration process smooth,

Thank you for the suggestion. It would be such a challenge task, because the difference between ExtJS 3 (base of Ext.NET v1) and ExtJS 4 (base of Ext.NET v2) is huge.

michaeld
Oct 09, 2013, 8:32 AM
I sympathize with your challenge given that I had to go through the same process. In the end I am happy I did. Layout reliability went up, as did other things, but it was a challenge. I haven't seen anything on the client-side doing what you're requesting, and certainly on the server-side it would be daunting, if not implausible. The best advise I can give is take the upgrade one step and functionality at a time and you'll get there.