PDA

View Full Version : Grid with default selection of the first row



bala_1404
14 Jan 2010, 6:01 AM
Hi All,

I am creating a Grid using


Grid<BeanModel> grid = new
Grid<BeanModel>(ListStore<BeanModel>, ColumnModel);
statement. I am able to see the data in the grid, but i want to show the first row of the grid as selected? how i can do this? can anybody please give me some solutions.

Thank you.

jay@moduscreate.com
14 Jan 2010, 8:36 AM
Moved to GXT help. Post in the correct forums next time :)

terciofilho
14 Jan 2010, 5:22 PM
Try this:


grid.getSelectionModel().select(0, false);

Arno.Nyhm
15 Jan 2010, 10:27 AM
but only after the store is loaded ;-) so you need to look for the event when the store is loaded.

terciofilho
15 Jan 2010, 11:18 AM
Good point:



store.getLoader().addListener(Loader.Load, new Listener<LoadEvent>()
{
public void handleEvent(LoadEvent le)
{
tableGrid.getSelectionModel().select(0, false);
}
});