PDA

View Full Version : [SOLVED] Display Search Result Count in regular Toolbar



Gordon76
25 Nov 2007, 7:29 AM
Hi everyone,

this is probably trivial, but I fiddled with it for two hours now and cant find the solution to it.

Ive got a grid. The tbar contains an inputfield that lets the user send search terms to the server. Results are loaded to a GroupingStore and displayed in the grid. This part is working fine.

Now I wanted to include a bbar that tells the user how many items were returned in total. I know how to get that number from the store and I know how to put a string in the toolbar initially - but I fail to get it updated. I added a listener to the store that fires on load and tried to update the count in various ways, but that didnt work.

I just got started with Ext and probably are missing a concept or two on how to do updates on already rendered elements. Could someone please point me to the right direction?

Thanks!

dxd
25 Nov 2007, 7:59 AM
Every component are registered, so if it's a TextItem in a toolbar, give it a id (example: "total-text")

Then do Ext.getCmp( 'total-text').getEl().innerHTML = "...";

Or , Ext.get( Ext.getCmp( 'total-text').getEl() ).update( "...." );

Gordon76
25 Nov 2007, 8:58 AM
Thanks for the quicky reply.

I still fail to grasp on how to add an ID to the textItem. The constructor doesnt take a config object. Just the string, so I cannot add my own id. But I managed to change the text now by doing the following:



bbar: new Ext.Toolbar({
id: 'myBbar',
items: [
'<span id="total-text">Please replace me</span>'
]
})


and then



Ext.get('total-text').update('here you are')


Now all i have to do add this to the load listener of my store. I should be able to get this working now. Thanks again!