PDA

View Full Version : Problem with dockedItems



lmanik
4 Feb 2012, 10:05 AM
Hi,

i have got problem with dockedItems in grid.panel.

This is my viewport:


{
id: 'content-panel',
region: 'center',
border: true,
layout: 'fit'
},


in controller i have this:


init: function() {
this.control({
'navigation-tree': {
itemclick: function (view, record) {
if (record.get('id')) {
var cmp = Ext.getCmp('content-panel');
cmp.removeAll();
cmp.add({xtype: record.get('id')});
console.log(record.get('id'));
}
}
}
})
}


and view is this:



Ext.require('Filters');


Ext.define('IS.view.checkout.View', {
extend: 'Ext.grid.Panel',
alias: 'widget.prodejna_pokladna',
store: 'checkout.View',

title: 'Pokladna',
border: false,
layout: 'fit',
id: 'prodejna_pokladna',
selModel: Ext.create('Ext.selection.CheckboxModel'),

columns: [
{header: 'ID', dataIndex: 'id', hidden: true},
{header: 'Datum', dataIndex: 'date', flex: 1},
{header: 'Description', dataIndex: 'desc', flex: 3},
{header: 'Cash', dataIndex: 'cash', flex: 1, align: 'right', renderer: function(value){ return Filters.number_color(value); }},
],

features: [{
ftype: 'grouping'
}],

dockedItems: [
{
xtype: 'pagingtoolbar',
store: 'checkout.View',
dock: 'bottom',
displayInfo: true,
},
{
xtype: 'cash.toolbar',
dock: 'top',
}],

initComponent: function () { this.callParent(arguments); this.store.loadPage(1); }
})


when i clicked in navigation to id prodejna_pokladna, its working, when i clicked to other id, its working, but when i clicked again to id prodejna_pokladna i get this message:



Uncaught TypeError: Cannot read property 'childNodes' of undefined


when i remove dockedItems from the view, its working.
Can you someone help me please?

mitchellsimoens
5 Feb 2012, 9:48 AM
You really shouldn't use ids unless you are debugging. You should also stay away from defining arrays and objects on the prototype as they can be shared among instances and not behave the way you want them to.