PDA

View Full Version : char counter in bbar



raj_plays
20 Oct 2010, 6:46 AM
Hi,
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.

Condor
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);

raj_plays
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')

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