Pregunta

Is there any way to set a dynamic name for column header, for example in a formatter function!?

I'll have a popup menu on the grid and depending on the chosen option it should change the name displayed in the column header.

¿Fue útil?

Solución

Its quite easy if you use dojo.query

var grid = dijit.byId('myGridId'),  NewHeader = "Foo Bar Text Content";
var columnHeaderNodes = dojo.query(
              '.dojoxGridHeader table th',
               grid.viewsHeaderNode)
var nthColumn = 12;
// if has child and its not a textnode - this may happen
// when there is a listener (dnd, click) attached for sorting etc.
if(columnHeaderNodes[nthColumn].firstChild && columnHeaderNodes[nthColumn].firstChild.nodeType != 3) 
    tgt = columnHeaderNodes[nthColumn].firstChild;
else tgt = columnHeaderNodes[nthColumn];
tgt.innerHTML = NewHeader;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top