I have an interesting problem which I have been trying to solve all day without success so I'm hoping somebody here can spot my issue. To summarise, I have a custom grid with the enableRowBody configuration set to true for the viewConfig but the markup for the second row is not being added to the grid rows.
I have made a custom resource class and have used the loadCustomCssJs function in my create controller to add a customised version of the create resource form which allows me to add the fields in my custom resource classes related tables.
The resource represents an event. I have added a grid to allow users to add multiple pricing for various vendors selling tickets.
My code for the extended LocalGrid I am using is:
rdBoxOffice.grid.Prices = function(config){
config = config || {};
this.exp = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template('test')
});
Ext.applyIf(config,{
id: 'rdboxoffice-grid-prices'
,url: rdBoxOffice.config.connectorUrl
,baseParams: { action: 'mgr/prices/getList' }
,pluralText: 'Prices'
,singleText: 'Price'
,preventRender:true
,autoHeight:true
,viewConfig: {
deferEmptyText: false
,enableRowBody: true
}
,tbar: [
{
title: _('listing_create_price'),
text: _('listing_create_price'),
handler: this.addPrice
}
]
,fields: [
'id'
,'vendor_id'
,'fullname'
,'regular'
,'vip'
,'student'
]
,paging:false
,remoteSort: false
,plugins: [this.exp]
,columns: [this.exp,{
header: _('listing_prices_vendor')
,dataIndex: 'fullname'
,sortable: true
,width: 100
},{
header: _('listing_prices_regular')
,dataIndex: 'regular'
,sortable: true
,width: 100
},{
header: _('listing_prices_vip')
,dataIndex: 'vip'
,sortable: true
,width: 100
},{
header: _('listing_prices_student')
,dataIndex: 'student'
,width: 100
}]
});
rdBoxOffice.grid.Prices.superclass.constructor.call(this,config);
};
Ext.extend(rdBoxOffice.grid.Prices,MODx.grid.LocalGrid)
In my create resource form I have added it as so:
{xtype:'rdboxoffice-grid-prices'}
To initially load some default pricing into the grid I have used the following code in the setup function for the resource panel - it works fine:
var pricesStore = Ext.getCmp('rdboxoffice-grid-prices').getStore();
record = new pricesStore.recordType({vendor_id:sitevendorid,fullname:'Website',regular:0,vip:0,student:0});
record.commit();
pricesStore.add(record);
pricesStore.commitChanges();
The panel is displayed and the default pricing loaded with the expand button showing that the row is contracted but when I look at the markup produced in the web developer console, there is no second row in the markup and therefore when clicking the expand button, I get an error because the row can't be found to add the compiled template.
Besides explicitly setting the enableRowBody config to true, I also note that the MODX derived grids all have enableRowBody set to true in their default configs but the grid is behaving as it's set to false. To confirm this I edited the ext-all.js file and modified the only mention of enableRowBody in there to output a string if enableRowBody is false. That string is output in my grid so somehow that config option is getting changed but I've no idea how.
I was wondering whether the way I was adding the record to the store was the problem but adding the data using loadData does display the data in the grid with the expand button but once again, no second row in the table holding the columns.
Update
I modified the ext-all.js file to set the enableRowBody configuration to true and that makes my grid work as expected with the second row added and my rowexpander works. That seems to suggest some kind of problem with the config being passed back to Ext.grid.Grid.
I'm open to all suggestions as to how to take this further.
[ed. note: freelancewebdev last edited this post 5 years, 8 months ago.]