I've figured it, some how i had to create(local variable) the grid local to the method and added to the content panel. Then this local grid, I assigned it to the global grid. fxed it.
On Wednesday, August 21, 2013 12:50:33 PM UTC-5, SaiP wrote: > > Hello, > > I'm new to GWT. I've a grid which has simple data mapped from a BaseModel. > When the user selects a row, it is supposed to be selected. I've checked a > few examples and post, it seems that we are doing it correctly. Code below > to create the grid. > > Could you please mention the senarios in which this selection will be > blocked? > > List<BaseModel> gridData= new ArrayList<BaseModel>(); > List<ColumnConfig> config = new ArrayList<ColumnConfig>(); > config.add(new ColumnConfig("isPrimary","Primary",70)); > config.add(new ColumnConfig("accountName","Account Name",320)); > config.add(new ColumnConfig("activeProgram","Active Program",150)); > config.add(new ColumnConfig("accountNumber","Account",100)); > config.add(new ColumnConfig("accountXref","Account Xref",150)); > config.add(new ColumnConfig("status","Status",93)); > ColumnModel cm = new ColumnModel(config); > PagingModelMemoryProxy proxy = new PagingModelMemoryProxy(gridData); > final PagingLoader<PagingLoadResult<Data>> loader = new > BasePagingLoader<PagingLoadResult<Data>>(proxy); > loader.setRemoteSort(false); > store = new GroupingStore<Data>(loader); > final PagingToolBar toolBar = new PagingToolBar(10); > toolBar.bind(loader); > loader.load(0, 10); > GroupingView view = new GroupingView(); > view.setShowGroupedColumn(true); > view.setForceFit(true); > view.setGroupRenderer(new GridGroupRenderer() { > public String render(GroupColumnData data) { > String l = data.models.size() == 1 ? "Item" : "Items"; > return data.group.substring(data.group.indexOf("|") + 1, > data.group.length()) > + " (" + data.models.size() + " " + l + ")"; > } > }); > ContentPanel cp = new ContentPanel(); > cp.setBodyBorder(false); > cp.setButtonAlign(HorizontalAlignment.CENTER); > cp.setLayout(new FitLayout()); > cp.setFrame(true); > cp.setSize(verticalPanelWidth, "300px"); > cp.setBorders(hidden); > cp.setBottomComponent(toolBar); > GWT.log("store size" + store.getCount()); > grid = new Grid<Data>(store,cm); > final GridSelectionModel<Data> sm = grid.getSelectionModel(); > sm.setSelectionMode(SelectionMode.SINGLE); > grid.setSelectionModel(sm); > final CellSelectionModel<Data> csm = new CellSelectionModel<Data>(); > csm.bindGrid(grid); > grid.setBorders(true); > grid.ensureDebugId("gridDebugId"); > //grid.ensureDebugId("gridDebugId"); > grid.setTabIndex(5); > cp.add(grid); > return cp; > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.