PDA

View Full Version : Grid + replacing the contents of a div rather than appending?



travisbell
22 Feb 2009, 7:08 PM
Hey guys,

Did a quick search for this but I didn't see anything come up with the exact scenario. Not that I expect it to be hard, just missing the right function...

Right now, my grid is being rendered like so:



...
enableColumnMove: false,
enableColumnResize: false,
renderTo: 'invoice-grid'
...


This seems to simply append the grid to the "invoice-grid" div. I'd like to degrade gracefully in this case so if JS was disabled, the contents of the "invoice-grid" will still show but naturally, with JS enabled it would be overwritten.

Is there a way to simply replace the content rather than append (ie. renderTo)?

evant
22 Feb 2009, 7:22 PM
You could remove the content from there if js is detected, eg.



//won't get here unless JS is running.
Ext.fly('invoice-grid').update('');
var g = new Ext.grid.GridPanel(....);

travisbell
22 Feb 2009, 7:27 PM
Yup, that will work nicely. Never thought of doing it that way since I just figured there was an option built in.

Thanks!