Our blazing fast Grid component built with pure JavaScript


Post 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);
 
Last edited by gregc on Sun Mar 14, 2021 7:35 pm, edited 1 time in total.

Post by mats »

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


Post by gregc »

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


Post by mats »

Just do:

 grid.columns.first.text = 'foo'

Post 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';


Post by mats »

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

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


Post by gregc »

Ahh gotcha, that works, awesome !


Post Reply