Hi John, Is this applicable for DataGrid too? Please see here <http://stackoverflow.com/questions/13151108/datagrid-in-gwt-cant-clear-it#comment17894401_13151108>for details.
Thanks, Mohit On Tuesday, 9 November 2010 01:11:35 UTC+5:30, Jeff Schwartz wrote: > > Using one of the concrete classes AsyncDataProvider or ListDataProvider > whose base class is AbstractDataProvider provides a very efficient > mechanism for accessing your widget's underlying data source as well as for > manipulating the display of the data itself. > > Once a ListDataProvider is setup you can do similar to below: > > dataProvider.getList().add(someObjectsList); // add a new SomeObject to > the list > sortSomeObjectsList(dataProvider.getList()); // call a method to sort the > list > dataProvider.refresh(); // tell all widgets using the data provider to > refresh themselves because the data has changed > > You can also add & replace lists in a ListDataProvider with: > > dataProvider.setList(someObjectsList); > > To set up a ListDataProvider: > > ListDataProvider<SomeObject> dataProvider = new > ListDataProvider<SomeObject>(); // strongly typed declaration - notice the > use of type T in the declaration which is the type specifier for the type > of objects in the list > dataProvider.setList(someObjectsList); // the list of objects to be > provided by the ListDataProvider > dataProvider.addDataDisplay(myCellWidget); // the widget the > ListDataProvider is providing the data to > > Jeff > > On Mon, Nov 8, 2010 at 1:22 PM, John LaBanca <jlab...@google.com<javascript:> > > wrote: > >> You can push new data into the widget using CellTable#setRowData() in >> conjunction with CellTable#setRowCount(). If you want to clear the data >> first, do the following: >> myCellTable.setRowCount(0); // Clears all data >> myCellTable.setRowCount(20, true); // Set the size of the new data >> myCellTable.setRowData(0, myData); // Set the new data >> >> In GWT 2.1.1, there is a new method CellTable#setRowData(List) that >> clears all existing data and replaces it with the specified list. >> >> Thanks, >> John LaBanca >> jlab...@google.com <javascript:> >> >> >> >> On Mon, Nov 8, 2010 at 5:13 AM, alf <alber...@gmail.com <javascript:>>wrote: >> >>> we are render a celltable widget nice when i push a boton. the >>> problems is when i will push the botton again i create other widget >>> and adding. How can clear all item adn populate the sam widget with >>> new datas. >>> >>> thanks and excuse for by bad english ans newbie question i have spent >>> hours fiding examples in doc >>> >>> al >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Google Web Toolkit" group. >>> To post to this group, send email to >>> google-we...@googlegroups.com<javascript:> >>> . >>> To unsubscribe from this group, send email to >>> google-web-toolkit+unsubscr...@googlegroups.com <javascript:>. >>> For more options, visit this group at >>> http://groups.google.com/group/google-web-toolkit?hl=en. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Web Toolkit" group. >> To post to this group, send email to >> google-we...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> google-web-toolkit+unsubscr...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/google-web-toolkit?hl=en. >> > > > > -- > Jeff > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/sTCRIE4aJz4J. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.