On 12/10/11 13:31, Sudhakar Abraham wrote:
First count the number of rows in FlexTable using getRowCount()
method.  Remove specific row from flex table using
removeRow( int row).

Ex:

   int count = myFlexTable.getRowCount();

   for (int i = 0; i<  count; i++)
   {
   myFlexTable.removeRow(i);
   }

S. Abraham
www.DataStoreGwt.com
Persist objects directly in App Engine

That code won't work. You'll probably get an IndexOutOfBoundsException. The 
first time through the loop, you will remove row 0. What was originally row 1 
will then be row 0, and what was originally row 2 will be row 1 etc. So on the 
second time through the loop, you remove row 1, but that is the row that was 
originally row 2. So the row that was originally row 1 would never be deleted. 
When you get far enough through removing rows, you'll get an exception.

To delete all the rows one at a time (rather than calling 
myFlexTable.removeAllRows()), try something like this:

  int count = myFlexTable.getRowCount();

  for (int i = count-1; i>=0 ; i--)
  {
        myFlexTable.removeRow(i);
  }

or else something like this:

  int count = myFlexTable.getRowCount();

  for (int i = 0; i<  count; i++)
  {
        myFlexTable.removeRow(0);
  }

Paul

--
You received this message because you are subscribed to the Google Groups "Google 
Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to