LucaMs Expert Licensed User Longtime User Dec 25, 2021 #1 Trying to hide the columns with "even header". (Project attached) Attachments B4XTableColumnsTest.zip B4XTableColumnsTest.zip 9.9 KB · Views: 475 Last edited: Dec 25, 2021
William Lancee Well-Known Member Licensed User Longtime User Dec 25, 2021 #2 The following hides the even columns, but I haven't figured out how to bring them back. B4X: Copy 'SHOULD hide even header columns. For i = B4XTable1.VisibleColumns.Size - 1 To 0 Step - 2 B4XTable1.VisibleColumns.RemoveAt(i) B4XTable1.Columns.Get(i).As(B4XTableColumn).Panel.Visible = False '<== Add Next Upvote 0
The following hides the even columns, but I haven't figured out how to bring them back. B4X: Copy 'SHOULD hide even header columns. For i = B4XTable1.VisibleColumns.Size - 1 To 0 Step - 2 B4XTable1.VisibleColumns.RemoveAt(i) B4XTable1.Columns.Get(i).As(B4XTableColumn).Panel.Visible = False '<== Add Next
William Lancee Well-Known Member Licensed User Longtime User Dec 25, 2021 #3 OK got it. B4X: Copy Private Sub Button1_Click ' Resets visible columns. Dim toggle As Boolean = B4XTable1.VisibleColumns.Size = 10 B4XTable1.VisibleColumns.Clear For Each clm As B4XTableColumn In B4XTable1.Columns B4XTable1.VisibleColumns.Add(clm) clm.Panel.visible = True Next If toggle Then 'SHOULD hide even header columns. For i = B4XTable1.VisibleColumns.Size - 1 To 0 Step - 2 B4XTable1.VisibleColumns.RemoveAt(i) B4XTable1.Columns.Get(i).As(B4XTableColumn).Panel.Visible = False '<== Add Next B4XTable1.Refresh End If lblVisibleColumns.Text = "Visible columns = " & B4XTable1.VisibleColumns.Size End Sub Upvote 0
OK got it. B4X: Copy Private Sub Button1_Click ' Resets visible columns. Dim toggle As Boolean = B4XTable1.VisibleColumns.Size = 10 B4XTable1.VisibleColumns.Clear For Each clm As B4XTableColumn In B4XTable1.Columns B4XTable1.VisibleColumns.Add(clm) clm.Panel.visible = True Next If toggle Then 'SHOULD hide even header columns. For i = B4XTable1.VisibleColumns.Size - 1 To 0 Step - 2 B4XTable1.VisibleColumns.RemoveAt(i) B4XTable1.Columns.Get(i).As(B4XTableColumn).Panel.Visible = False '<== Add Next B4XTable1.Refresh End If lblVisibleColumns.Text = "Visible columns = " & B4XTable1.VisibleColumns.Size End Sub
LucaMs Expert Licensed User Longtime User Dec 25, 2021 #4 William Lancee said: OK got it. Click to expand... Note that even columns are displayed last (no longer in order). However, with some effort you can find a workaround (maybe) but I think there is a bug in the B4XTable, because the attached project should work (unless I have misunderstood how it works). Upvote 0
William Lancee said: OK got it. Click to expand... Note that even columns are displayed last (no longer in order). However, with some effort you can find a workaround (maybe) but I think there is a bug in the B4XTable, because the attached project should work (unless I have misunderstood how it works).
William Lancee Well-Known Member Licensed User Longtime User Dec 25, 2021 #5 Yes, the order was wrong. I put refresh in wrong place. Is the original question a bug? Maybe you should post it there. B4X: Copy Private Sub Button1_Click ' Resets visible columns Dim toggle As Boolean = B4XTable1.VisibleColumns.Size = 10 B4XTable1.VisibleColumns.Clear For Each clm As B4XTableColumn In B4XTable1.Columns B4XTable1.VisibleColumns.Add(clm) clm.Panel.visible = True Next If toggle Then 'SHOULD hide even header columns. For i = B4XTable1.VisibleColumns.Size - 1 To 0 Step - 2 B4XTable1.VisibleColumns.RemoveAt(i) B4XTable1.Columns.Get(i).As(B4XTableColumn).Panel.Visible = False '<== Add Next End If B4XTable1.Refresh '<== Move to here lblVisibleColumns.Text = "Visible columns = " & B4XTable1.VisibleColumns.Size End Sub Upvote 0
Yes, the order was wrong. I put refresh in wrong place. Is the original question a bug? Maybe you should post it there. B4X: Copy Private Sub Button1_Click ' Resets visible columns Dim toggle As Boolean = B4XTable1.VisibleColumns.Size = 10 B4XTable1.VisibleColumns.Clear For Each clm As B4XTableColumn In B4XTable1.Columns B4XTable1.VisibleColumns.Add(clm) clm.Panel.visible = True Next If toggle Then 'SHOULD hide even header columns. For i = B4XTable1.VisibleColumns.Size - 1 To 0 Step - 2 B4XTable1.VisibleColumns.RemoveAt(i) B4XTable1.Columns.Get(i).As(B4XTableColumn).Panel.Visible = False '<== Add Next End If B4XTable1.Refresh '<== Move to here lblVisibleColumns.Text = "Visible columns = " & B4XTable1.VisibleColumns.Size End Sub
LucaMs Expert Licensed User Longtime User Dec 25, 2021 #6 William Lancee said: Is the original question a bug? Maybe you should post it there. Click to expand... Not sure but it could be. Upvote 0
William Lancee said: Is the original question a bug? Maybe you should post it there. Click to expand... Not sure but it could be.
Erel B4X founder Staff member Licensed User Longtime User Dec 26, 2021 #7 The feature you are trying to implement isn't directly supported. VisibleColumns is not expected to change after SetData was called. You will either need to manually modify the layout as @William Lancee did or clear the table and call SetData again. Upvote 0
The feature you are trying to implement isn't directly supported. VisibleColumns is not expected to change after SetData was called. You will either need to manually modify the layout as @William Lancee did or clear the table and call SetData again.
LucaMs Expert Licensed User Longtime User Dec 26, 2021 #8 Erel said: The feature you are trying to implement isn't directly supported. VisibleColumns is not expected to change after SetData was called. You will either need to manually modify the layout as @William Lancee did or clear the table and call SetData again. Click to expand... I thought I would find your solution here, this morning; a bit like you were dressed in red, with a big belly and a long white beard ? ? Ok, I understand your answer; however, I am not very clear about the usefulness of VisibleColumns: they are all the columns, since you cannot scroll the columns horizontally, right? P.S. I woke up: I assume they correspond to the currently visible page. The purpose is to be able to manage the columns of the page currently displayed, for example to highlight some values. Last edited: Dec 26, 2021 Upvote 0
Erel said: The feature you are trying to implement isn't directly supported. VisibleColumns is not expected to change after SetData was called. You will either need to manually modify the layout as @William Lancee did or clear the table and call SetData again. Click to expand... I thought I would find your solution here, this morning; a bit like you were dressed in red, with a big belly and a long white beard ? ? Ok, I understand your answer; however, I am not very clear about the usefulness of VisibleColumns: they are all the columns, since you cannot scroll the columns horizontally, right? P.S. I woke up: I assume they correspond to the currently visible page. The purpose is to be able to manage the columns of the page currently displayed, for example to highlight some values.
Erel B4X founder Staff member Licensed User Longtime User Dec 27, 2021 #9 LucaMs said: Ok, I understand your answer; however, I am not very clear about the usefulness of VisibleColumns: they are all the columns, since you cannot scroll the columns horizontally, right? Click to expand... The table acts as a user interface element and as a data store. The VisibleColumns list allows the developer to include data that will not be displayed, but will still be accessible programmatically. Upvote 0
LucaMs said: Ok, I understand your answer; however, I am not very clear about the usefulness of VisibleColumns: they are all the columns, since you cannot scroll the columns horizontally, right? Click to expand... The table acts as a user interface element and as a data store. The VisibleColumns list allows the developer to include data that will not be displayed, but will still be accessible programmatically.
LucaMs Expert Licensed User Longtime User Dec 27, 2021 #10 Certainly this View is quite important, especially for B4J (but not only for this). It deserves more work. I know, I should write which features should be added or improved, but I will do so "soon" with a "Wish" (I have "seen" them using it these days but have not written them down). Thank you, Erel. Upvote 0
Certainly this View is quite important, especially for B4J (but not only for this). It deserves more work. I know, I should write which features should be added or improved, but I will do so "soon" with a "Wish" (I have "seen" them using it these days but have not written them down). Thank you, Erel.