PDA

View Full Version : Need help to change the ExtJs3.4 code to ExtJs4.1.1a



g.raghuvamshi
27 Sep 2012, 2:07 AM
Hi,

As I am new to ExtJs, need some help in upgrading to new version.

ExtJs 3.4 version code:

Accero.Admin.EnvironmentGridPanel = function( config ) {


this.jsonStore = new Ext.data.JsonStore({
proxy : new Ext.data.HttpProxy({
url : 'rs/environments',
disableCaching: true
}),
restful : true,
storeId : 'Environments',
idProperty: 'env',
fields : [
'ConnectionName', 'Type'
]
});

this.colmodel = new Ext.grid.Panel({
columns: [{
header: Accero.Locale.text.adminlogin.connectionsHeading,
width : 140,
dataIndex: 'ConnectionName'
},
{
header: Accero.Locale.text.adminlogin.connectionTypeHeader,
width : 120,
dataIndex: 'Type'
}]
});


config = Ext.apply({
enableHdMenu: false,
border : true,
stripeRows : true,
store : this.jsonStore,
view : new Ext.grid.View(),
header : false,
colModel : this.colmodel,
selType : 'rowmodel',
loadMask: {
msg: Accero.Locale.text.adminlogin.loadingmask
}
}, config);

Could anyone suggest what are the changes required while upgrading to the ExtJS4.1.1a?

Many thanks,
Raghu

scottmartin
1 Oct 2012, 10:22 AM
There is no longer a ColModel, just and object for the columns.

A little confused with

this.colmodel = new Ext.grid.Panel({

Is this a grid or your columns? Readability issue ...

Do you want to use Ext.create, or stay with new Ext ... ??

You should be able to review several of our example and make the changes needed, as there are several ways to approach this based on your coding style .. and then there is MVC approach.

Scott.

g.raghuvamshi
2 Oct 2012, 9:55 PM
Hi Scott,

Thank you for the reply.

I modified the above old code using 'Ext.create'. Could you please revert if there are any issues with the below new code?

var config = Ext.create('Ext.grid.Panel', {
autoScroll:true,
defaults: { // defaults are applied to items, not the container
sortable:true
},
selModel: 'rowmodel',
columns: [
{header: Accero.Locale.text.adminlogin.connectionsHeading, width: 140, dataIndex: 'ConnectionName'},
{header: Accero.Locale.text.adminlogin.connectionTypeHeader, width: 120, dataIndex: 'Type'}
]
}, config);

Thanks again.

Raghu