PDA

View Full Version : Changing the Text of a Toolbar.TextItem



mrollins
7 Mar 2008, 10:43 AM
I have a grid in which I want to put a total count of the rows in the grid. My thought was to put a Toolbar.TextItem in the bottombar and then update the text of that TextItem when the store changes. I listen for the datachanged event on the store.

I keep a hold of the TextItem, rather than creating it anonymously.


var myTI = new Ext.Toolbar.TextItem('foo');

I was thinking I could grab the dom from the element and then just change the value, like this:


myTI.getEl().dom.value = 'new foo';

However, there is no dom attached to that object. Further, there's no obvious way to update the text of the TextItem. Anyone have any suggestions? I'm going to have to do this for more than the count in the grid, so this problem is going to come up again in the same grid.

Animal
7 Mar 2008, 10:59 AM
If you use this toolbar class http://extjs.com/forum/showthread.php?p=122647#post122647

(An improved version of which will hopefully be in the next version of Ext) Then TextItems have a setText method.

mrollins
7 Mar 2008, 1:10 PM
Awesome, thank you so much. I'll check it out.