PDA

View Full Version : problen with extend EditorGridPanel



klerick
14 Jun 2010, 9:48 AM
Hi, I have some problems. I try to extend EditorGridPanel. My idea is a send request via Ajax and get data for ColumnModel and DataStore as array. Then I try to create object with my extend EditorGridPanel and transmit it. but it fails. What am I doing wrong?. Please give me solution or link to example.





Ext.ux.ApplicationGrid = Ext.extend(Ext.grid.EditorGridPanel, {
initComponent: function() {

Ext.apply(this, {
store: new Ext.data.Store({
id:this.idColume+'Store',
proxy: new Ext.data.HttpProxy({
url: this.urlData,
method: 'POST'
}),
reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'total',
id: this.idColume
},
this.storeData
),
sortInfo:{field: this.idColume, direction: "ASC"}
})
});
Ext.apply(this, {
cm:new Ext.grid.ColumnModel(this.columData)
});

Ext.apply(this, {
bbar: new Ext.PagingToolbar({
pageSize: 30,
store: this.store,
displayInfo: true,
displayMsg: "Displaying accounts {0} - {1} of {2}",
emptyMsg: "No accounts to display"
}), tbar: new Ext.Toolbar({
items: [{
text: "Add",
handler: this.entityAdd.createDelegate(this)
},{
text: "Edit",
handler: this.entityEdit.createDelegate(this)
},{
text: "Remove",
handler: this.entityRemove.createDelegate(this)
}]
})
});
Ext.ux.ApplicationGrid.superclass.initComponent.apply(this, arguments);
},
onDestroy: function(){
Ext.ux.ApplicationGrid.superclass.onDestroy.call(this);
},
entityAdd: function(button, e){},
entityRemove: function(button, e){},
entityEdit: function(button, e){},
idColume:undefined,
urlData:undefined,
columData:undefined,
storeData:undefined,
title: undefined,
id: this.idColume+'Grid',
autoWidth: true,
autoHeight: true,
enableColLock:false,
clicksToEdit:2,
//scroll: true,
selModel: new Ext.grid.RowSelectionModel({singleSelect:false})
});
Ext.reg("applicationgrid", Ext.ux.ApplicationGrid);


langFace = function(data){

this.gridPanel = '';
this.columArray = new Array();
this.storeArray = new Array();
for (var key in data) {
obj_colum = new Object();
obj_store = new Object();
if(key != 'remove'){
for (var k in data[key]) {
if(k == 'name' || k == 'type' || k == 'mapping'){
obj_store[k] = data[key][k];
}
if(k == 'header' || k == 'dataIndex' || k == 'width' || k == 'readOnly'){
obj_colum[k] = data[key][k];
}
}
}

this.columArray.push(obj_colum);
this.storeArray.push(obj_store);

}

this.gridPanel = new Ext.ux.ApplicationGrid({
idColume:'lang_key_id',
urlData:'/admin/lang/data',
columData:this.columArray,
storeData: this.storeArray,
title:"Lang"
});

//this.gridPanel.reconfigure();

return this.gridPanel;

};

obj = {
action:'langInfo'
}
sendAjax.send(obj, '/admin/lang/colum',langFace);

16 Jun 2010, 6:14 PM
First issue: don't add your application namespace inside of Ext JS's name space.