PDA

View Full Version : rowexpander extjs 4.2.1.883



oturkan
14 Jun 2013, 4:06 PM
Hi,

I'm using RowExpander but this line (nextBd = row.down(me.rowBodyTrSelector, true)) is null. Because there is no row in html.

help me. thanks



initComponent: function () {
var me = this;
var storeFields = new Array();


me.gridInfo = Ext.decode(AjaxHandler.GetGridJSon(me.initialConfig.code).value);
me.actionMenu = Ext.create('Ext.menu.Menu',
{
items: me.gridInfo.ContextMenu,
listeners: {
click: function (menu, item, e, eOpts) {
me.contextmenuclick(menu, item, e, eOpts);
}
}
});


this.addEvents('contextmenuclick');


for (var i = 0; i < me.gridInfo.Columns.length; i++) {
storeFields.push({ name: me.gridInfo.Columns[i].dataIndex });
}


Ext.define('SearchThread', {
extend: 'Ext.data.Model',
fields: storeFields,
idProperty: me.gridInfo.SearchPropertyId
});


me.columns = me.gridInfo.Columns;
me.store = Ext.create('Ext.data.Store', {
pageSize: parseInt(me.gridInfo.PageSize),
model: 'SearchThread',
proxy: {
type: 'ajax',
url: me.gridInfo.SearchUrl,
reader: {
type: 'json',
root: 'Rows',
totalProperty: 'totalCount'
}
}
});

me.plugins = [{
ptype: 'rowexpander',
rowBodyTpl: new Ext.XTemplate(
'<p><b>Company:</b> {CustomerCode}</p>',
'<p><b>Change:</b> {FirstName}</p><br>',
'<p><b>Summary:</b> {LastName}</p>'
)
}];

me.store.load({ params: { start: 0, limit: parseInt(me.gridInfo.PageSize) } });


me.callParent();

slemmon
17 Jun 2013, 11:18 AM
Hmm.. not sure how to help, yet. I tried with a test grid in 4.2.1 with the plugin from your code and I didn't see any errors.



Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody(),
plugins: [{
ptype: 'rowexpander',
rowBodyTpl: new Ext.XTemplate(
'<p><b>Company:</b> {CustomerCode}</p>',
'<p><b>Change:</b> {FirstName}</p><br>',
'<p><b>Summary:</b> {LastName}</p>'
)
}]
});

oturkan
17 Jun 2013, 10:03 PM
I have fixed the problem. It' my mistake. I set grid height : '100%'. That's why giving error.

thank you