PDA

View Full Version : grid detection



mfw24
28 Jun 2007, 7:50 PM
what is the logic to determine if there is a grid already rendered on the page? (so i can refresh data to it)

i thought i could simply use this, but it doesnt work

if (grid)


else

tryanDLS
29 Jun 2007, 9:05 AM
Is 'grid' a variable that's in scope when you make that check?

fay
29 Jun 2007, 9:14 AM
Open the array-grid.html example in FireFox (with FireBug). Put a breakpoint at line 106 (the call to grid.render()), take a look at the watch window and you will see a public property: rendered = false; step over the line and rendered = true... so to make a short story shorter, check the value of rendered:


if (grid.rendered){
}

Is the idea is to update a grid when a store has been reloaded? Is the grid's ds not pointing to the store already?

To update the grid: grid.getView().refresh();

And Tim's question still stands... scope?

mfw24
29 Jun 2007, 9:10 PM
i get the grid to update the data, but the size of the grid stays the same..i can't get this grid to resize to the data. I've tried setting autosize, autoheight...nothing seems to work. Any ideas?

Animal
29 Jun 2007, 11:43 PM
After updating the data (using it's Store), you will need to ask the Grid to autosize:

http://extjs.com/deploy/ext-1.1-beta2/docs/output/Ext.grid.Grid.html#autoSize