JdV Active Member Licensed User Longtime User Sep 29, 2023 #1 Hello I don't know if this is a bug but see attached program. The table is filled with numbers 0 to 100 Click on the column header to sort the numbers from 100 to 0 Click the Reset button The table is cleared and then re-filled with numbers 0 to 100 The column still indicates that it's sorting from highest to lowest number Is this a bug? Is TableView1.items.clear the correct way to effectively reset a table? Is there a way to find out which column is being used to sort? Regards Joe Attachments TableTest.zip TableTest.zip 2 KB · Views: 466
Hello I don't know if this is a bug but see attached program. The table is filled with numbers 0 to 100 Click on the column header to sort the numbers from 100 to 0 Click the Reset button The table is cleared and then re-filled with numbers 0 to 100 The column still indicates that it's sorting from highest to lowest number Is this a bug? Is TableView1.items.clear the correct way to effectively reset a table? Is there a way to find out which column is being used to sort? Regards Joe
agraham Expert Licensed User Longtime User Sep 29, 2023 #2 Yes, I would regard that as a minor bug. However you can easily overcome it B4X: Copy Sub Button1_Click Dim l As List l.Initialize TableView1.Items = l FillTable End Sub Sub FillTable For i=0 To 100 Dim row() As Object = Array(Rnd(0, 100)) TableView1.Items.Add(row) Next End Sub
Yes, I would regard that as a minor bug. However you can easily overcome it B4X: Copy Sub Button1_Click Dim l As List l.Initialize TableView1.Items = l FillTable End Sub Sub FillTable For i=0 To 100 Dim row() As Object = Array(Rnd(0, 100)) TableView1.Items.Add(row) Next End Sub
JdV Active Member Licensed User Longtime User Sep 29, 2023 #3 That's a beautifully simple solution. Thanks. Is there no way to find out what column (if any) is being sorted so that when the table is refilled, it can be sorted again by that column?
That's a beautifully simple solution. Thanks. Is there no way to find out what column (if any) is being sorted so that when the table is refilled, it can be sorted again by that column?
agraham Expert Licensed User Longtime User Sep 29, 2023 #4 JdV said: Is there no way to find out what column (if any) is being sorted Click to expand... Not that I can see without poking around inside it with JavaObject and I'm not sure even then. JdV said: when the table is refilled, it can be sorted again by that column Click to expand... This should do that B4X: Copy Sub Button1_Click TableView1.Items.Clear FillTable Dim jo As JavaObject = TableView1 jo.RunMethod("sort", Null) End Sub Sub FillTable For i=0 To 100 Dim row() As Object = Array(Rnd(0, 100)) TableView1.Items.Add(row) Next End Sub
JdV said: Is there no way to find out what column (if any) is being sorted Click to expand... Not that I can see without poking around inside it with JavaObject and I'm not sure even then. JdV said: when the table is refilled, it can be sorted again by that column Click to expand... This should do that B4X: Copy Sub Button1_Click TableView1.Items.Clear FillTable Dim jo As JavaObject = TableView1 jo.RunMethod("sort", Null) End Sub Sub FillTable For i=0 To 100 Dim row() As Object = Array(Rnd(0, 100)) TableView1.Items.Add(row) Next End Sub