I have to add a label in Ext JS Grid PageBar for displaying a dynamic data. I added it. I need to update it when data changes. But its not overwriting the data in the label. Its creating new labels with new data in the pagebar.
Here is my code
listeners : {
change : function(thisd, params){
var label = new Ext.form.Label({});
var count = Grid.getStore().getCount();
label.setText('(no : ' + count + ')');
Bbar.items.add(label);
Bbar.doLayout();
}
}
Any help is must appreciated...Thankz
Of course it is creating new label each time - this is how you programmed it. You need to create label once, assign some kind of identifier to it (id, itemId etc), and then in your listener find that label and just call setText()
on it.