I have to set the column positions in TableView (NOT B4x Table) programmaticly, e.g. Col3, Col0, Col1, Col2.
How can i do that programmaticly ?
Thank you!
Hi to all, Based on the B4XTable library, I have made a small enhancement that is extremely practical for the user. It enables three additional functionalities: a) Reordering of row sequence and column lengths b) Resetting the saved layout (to default layout) c) Exporting data to Excel The...
www.b4x.com
With small modification you can use the same logic with a TableView... Or I can prepare example which will help you to create end solution...
I have to set the column positions in TableView (NOT B4x Table) programmaticly, e.g. Col3, Col0, Col1, Col2.
How can i do that programmaticly ?
Thank you!
' put cols in order 2,0,1 - with some bad column numbers added tooMe.as(JavaObject).RunMethod("orderOfCols",Array(TableView1,ArrayAs Int(2,-3,0,1,9)))
B4X:
#if java
import javafx.scene.control.TableView;
import javafx.scene.control.TableColumn;
public static void orderOfCols(TableView tv,int[] order){
// number of columns in table
int colcnt = tv.getColumns().size();
// dimension our saved columns
TableColumn[] cols = new TableColumn[colcnt];
// grab original columns
for (int a = 0 ; a< colcnt; a++){
cols[a] = (TableColumn)tv.getColumns().get(a);
}
// clear the columns in the tableview
tv.getColumns().clear();
// insert our saved columns back into tableview in the order we want
for (int aaa : order){
// check for valid columns
if (aaa >colcnt || aaa < 0) continue;
tv.getColumns().add(cols[aaa]);
}
}
#End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.