I have a trouble about render a grid with toolbar in a collapsible panel. As you see on code at bottom, I have reader, store, grid with bbar and panel. When I set collapsible property of panel to false grid's toolbar render perfectly. But, when I set panel collapsible property to true then I expand panel, I can not see the toolbar. I want to show grid with toolbar and data on panel expand without any trouble. How can I repair this code?
Thx all.
var reader_DailyActivity = new Ext.data.JsonReader({
totalProperty : 'total',
successProperty : 'success',
root : 'data',
fields : [
{name: 'date'},
{name: 'time'},
{name: 'description'},
{name: 'speed'},
{name: 'distance'},
{name: 'type'},
{name: 'source'}
]
});
var store_DailyActivity = new Ext.data.Store({
id : 'dailyActivityStoreID',
reader : reader_DailyActivity
});
var pagingToolbar = new Ext.PagingToolbar({
pageSize : 20,
buttonAlign : 'center',
store : store_DailyActivity
});
var DailyActivityGrid = new Ext.grid.GridPanel({
id : 'dailyActivityGrid',
store : store_DailyActivity,
loadMask : true,
height : 300,
autoScroll : true,
viewConfig : {
emptyText : 'No Record Found',
deferEmptyText : false,
forceFit : true
},
columns :[
{header: 'Date', dataIndex: 'date'},
{header: 'Time', dataIndex: 'time'},
{header: 'Description', dataIndex: 'description'},
{header: 'Speed', dataIndex: 'speed'},
{header: 'Distance', dataIndex: 'distance'},
{header: 'Type', dataIndex: 'type'},
{header: 'Source', dataIndex: 'source'}
],
bbar : pagingToolbar
});
var VehicleDetail = new Ext.Panel({
title : 'Activity Details',
id : 'panel_DetailID',
collapsible : true,
collapsed : true,
renderTo : 'renderedDivID',
items : DailyActivityGrid,
listeners : {
'expand' : function(hede)
{
var panelMask = Ext.getCmp('panel_DetailID');
// mask grid panel
panelMask.getEl().mask('Please Wait');
Ext.Ajax.request({
url: 'url comes here',
params:
{
param1 : reqParam1,
start : 0,
limit : 20
},
success: function (result, request)
{
var resData = Ext.util.JSON.decode(result.responseText);
store_DailyActivity.loadData(resData);
// unmask grid panel
panelMask.getEl().unmask();
},
failure: function ()
{
console.log('error');
}
});
}
}
});