PDA

View Full Version : Changing Grid Column text



faizur
10 Oct 2006, 5:06 AM
How can I change the Grid Column Header text at runtime?

jack.slocum
10 Oct 2006, 7:29 AM
colModel.setColumnHeader(colIndex, "New Text");

It will automatically be updated in the grid view.

faizur
10 Oct 2006, 10:08 AM
Hi Jack,
Thanks for your reply.

But I need to load the caption at runtime. So is it possible to getEl(..) to get the header so that i can use it to do something like el.getUpdateManager.update(..)

Cheers

jack.slocum
10 Oct 2006, 11:27 AM
Ah, I see. I guess you could do something like this but it's not guaranteed to function if the internal structure of GridView happens to be changed.

getEl(grid.getView().headers[0].textNode, true).getUpdateManager().load(...);

It's certainly not pretty either. ;)

I'd recommend making a standard Connect call, get the text and using the column model method I posted above. It's not a 1 liner, but it doesn't access private variables and is a little safer.

kushal
7 Sep 2007, 2:01 AM
I am not sure whether anyone tried updating the header text at runtime but I did it and following was the error.

this.updateHeaderText() not a function

tried to trace the problem and found that setColumnHeader() internally fires the event onHeaderChange which further calls this function.

But this function was not defined anywhere in the entire EXT context.
Please help!!!:(

evant
7 Sep 2007, 2:18 AM
GridView.js, around line 500.

kushal
7 Sep 2007, 3:54 AM
thanks for the quick reply
but I still cannot locate it

if possible could you please attach the gridview.js that u are mentioning about!

Thanks!!