View Full Version : char counter in bbar

20 Oct 2010, 6:46 AM
I have a Grid with a RowEditor.
When I enter text in one column of the editor, I want a character counter to show in the bottom bar.
How is this possible?

I can put a listener for keypress in the text field and get the count but I can't figure out how to display it.
My grid does not have or need a paging bar.
Please help.

20 Oct 2010, 6:50 AM
Define your bbar as:

bbar: [{
xtype: 'tbtext',
id: 'counter'
So you can use something like:

Ext.getCmp('counter').setText('Char count = ' + count);

21 Oct 2010, 12:34 AM
Thank you, Condor. Works great!!

In the bbar, can i use itemId instead of id and replace the second part with

Grid.getTopToolbar().getComponent('counter').setText(count + ' chars left')

21 Oct 2010, 12:45 AM
Yes, as long as you have a reference to the grid in your keypress listener.