java - Gwt flex table getRowCount() method not returning current value -


i using gwtflextable , have 1 issue: deleting row after when try add new row giving rowcount value including removed row because of while iterating last row giving indexoutofboundsexception.

for( count=0; count < table.getrowcount(); count++ ) {  } 

giving exception

[fatal] uncaught exception:  [java] java.lang.indexoutofboundsexception:  [java] column index: 0, column size: 0 

please have @ demo on gwt showcase - flextable.

here code add/remove row directly show case. use these method perform these operation. check row count first before doing operation.

/**  * add row flex table.  */ private void addrow(flextable flextable) {     int numrows = flextable.getrowcount();     flextable.setwidget(numrows, 0, widget1));     flextable.setwidget(numrows, 1, widget2));     flextable.getflexcellformatter().setrowspan(0, 1, numrows + 1); }  /**  * remove row flex table.  */ private void removerow(flextable flextable) {     int numrows = flextable.getrowcount();     if (numrows > 1) {         flextable.removerow(numrows - 1);         flextable.getflexcellformatter().setrowspan(0, 1, numrows - 1);     } } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -