PDA

View Full Version : help for ext.extend



benimben61
8 Feb 2010, 10:41 AM
Is the code true =? i got some errors. Can anyone help me?


var PersonnelGrid = Ext.extend(Ext.grid.GridPanel, {
border: false,
initComponent: function () {
var config = {
store: new Ext.data.JsonStore({
url: 'loadSecilecekAsilPersonelStore.ajax',
fields: ['id', 'adiSoyadi', 'kurumId', 'unvan', 'gorevi'],
id: 'id',
totalProperty: 'totalCount',
root: 'data'
})
//,columns:[{}, {}]
,
cm: new Ext.grid.ColumnModel([
//new Ext.grid.RowNumberer(),
{
header: 'Ad? Soyad?',
dataIndex: 'adiSoyadi',
width: 200
},
{
header: 'Ünvan?',
dataIndex: 'unvan',
width: 120
}])

,
plugins: [new Ext.ux.grid.Search({
searchText: 'Ara',
mode: 'remote',
iconCls: false,
dateFormat: 'd m Y H:i',
position: 'top',
readonlyIndexes: ['adiSoyadi'],
//disableIndexes:['hazirlamaTarihi'],
minChars: 2,
autoFocus: true
})],
viewConfig: {
forceFit: false
}

,
stripeRows: true,
loadMask: true,
frame: true,
iconCls: 'icon-grid',
title: 'Seçilebilecek Asiller',
sm: new Ext.grid.RowSelectionModel(),
tbar: new Ext.Toolbar({
items: ['-', {
text: 'Personel Seç',
iconCls: 'buton-ekle',
handler: function (btn, pressed) {
var g1 = Ext.getCmp('asilSecilecekGrid');
var g2 = Ext.getCmp('asilSecilenGrid');
var recs = g1.getSelectionModel().getSelections();
g2.getStore().add(recs);
for (var i = 0; i < recs.length; i++) {
g1.getStore().remove(recs[i]);
}
}
}]
}),
bbar: new Ext.PagingToolbar({
pageSize: 5,
store: this.getStore(),
emptyMsg: "Görüntülenecek Ö?e Bulunmamaktad?r."
})
}; // eo config object
// apply config
Ext.apply(this, Ext.apply(this.initialConfig, config));

Application.PersonnelGrid.superclass.initComponent.apply(this, arguments);
} // eo function initComponent
,
onRender: function () {
this.store.load({
params: {
start: 0,
limit: 5
}
});
PersonnelGrid.superclass.onRender.apply(this, arguments);
} // eo function onRender
,
rowdblclick: function (grid, index) {
var record = this.getStore().getAt(index);
var g2 = Ext.getCmp('asilSecilenGrid');
g2.getStore().add(record);
this.getStore().remove(record);
}
});

Ext.reg('personnelgrid', PersonnelGrid)