Page 1 of 1

[Resolved] Changing a column text label

Posted: Sun Mar 14, 2021 5:55 pm
by gregc

I can change the text of a column dynamically, but what do I do to refresh the column header?

e.g. this doesn't refresh it:

 grid.columns.data[2].text='wow';
grid.renderContents();
grid.store.loadPage(grid.store.currentPage);
 

Re: Changing a column text label

Posted: Sun Mar 14, 2021 6:34 pm
by mats

How do you mean refresh a column header? What are you trying to achieve other than changing the column text?


Re: Changing a column text label

Posted: Sun Mar 14, 2021 7:07 pm
by gregc

Just trying to change the label without having to reload the whole page.


Re: Changing a column text label

Posted: Sun Mar 14, 2021 7:09 pm
by mats

Just do:

 grid.columns.first.text = 'foo'

Re: Changing a column text label

Posted: Sun Mar 14, 2021 7:24 pm
by gregc

ok. what is the dot notation to reference it by fieldname or by nbr i.e. nth column
my guessing is not right
window.genericgrid.columns.category2.text='wow';
window.genericgrid.columns.get('category2').text='wow';


Re: Changing a column text label

Posted: Sun Mar 14, 2021 7:32 pm
by mats

"columns" is a regular store, so use the id of your column:

grid.columns.getById('mycolumn').text='wow';


Re: Changing a column text label

Posted: Sun Mar 14, 2021 7:34 pm
by gregc

Ahh gotcha, that works, awesome !