B4J Question (Table View) Preventing user from altering column order

MegatenFreak

Active Member
Licensed User
Hi.
Is there a way to prevent the user from switching the position of tableview columns?
Normally it wouldn't be a problem, but when I try to retrieve data from textfields inside the table, I retrieve it in as an array object, and if the position is altered, then I'll get the wrong item:

B4X:
Dim row() as Object = MyTable.Items.Get(0)
Dim txf as TextField = row(1)     'The second column is expected to be the textfield, but it will be messed up if the user moves it.

Thanks in advance.
 

LucaMs

Expert
Licensed User
Longtime User
B4X:
Private Sub DisableReordering(TV As TableView)
    Dim Jo As JavaObject = TV
    Dim Header As JavaObject = Jo.RunMethod("lookup", Array("TableHeaderRow"))
    Dim Prop As JavaObject = Header.RunMethod("reorderingProperty", Null)
    Dim o As Object = Prop.CreateEventFromUI("javafx.beans.value.ChangeListener", "HeaderOrder", Null)
    Prop.RunMethod("addListener",Array(o))
End Sub
 
Upvote 0

MegatenFreak

Active Member
Licensed User
It didn't work. But it seems like reordering the columns by the user will not change the node array's structure. So it should be okay.
 
Upvote 0

behnam_tr

Active Member
Licensed User
Longtime User
use this lib
its ok
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…