I've been literally fighting ? with the column headers of a B4XTable for many hours (not consecutively, "fortunately").
Only now did I see this thread:
https://www.b4x.com/android/forum/threads/b4x-b4xtable-with-custom-cells-layout.102352/
but for the moment I still don't know if it will help me, mainly because I ADD views, to the headers and by loading a layout.
What I do is load into the header cell a layout containing a basic panel that has some Views (one of this is a B4XImageView, for this reason I don't create the layout by code, unlike the example in that thread). I assign a tag to the panel, let's say "Goofy".
Subsequently I want to be able to remove the panel, so I search and find the panel with the "Goofy" tag, I empty it with RemoveAllViews and finally I remove the panel itself, with RemoveViewFromParent.
Once this is done, however, the header no longer seems to have a "layout", the text remains but not the initial colored and "bordered" rectangle. The worst thing is that when you click on it, the project crashes, because Row in this line (B4XTable source code) do not contains a number:
as if I had changed that pnl.Parent.Tag or had created that pnl again.
I know this is hard to understand.
I hope for Erel's great intelligence (I'm very envious? [really, I'm not kidding]) and tomorrow or maybe sooner I'll attach an example.
[Too bad today is Friday (I don't specify the reason for this)]
[BTW] To test, I loaded the B4XTable source and all its dependencies, including the layout file. Strangely, the cells remain empty. I saw that the problem depends on AddNonQueryToBatch, but I didn't investigate further.
Only now did I see this thread:
https://www.b4x.com/android/forum/threads/b4x-b4xtable-with-custom-cells-layout.102352/
but for the moment I still don't know if it will help me, mainly because I ADD views, to the headers and by loading a layout.
What I do is load into the header cell a layout containing a basic panel that has some Views (one of this is a B4XImageView, for this reason I don't create the layout by code, unlike the example in that thread). I assign a tag to the panel, let's say "Goofy".
Subsequently I want to be able to remove the panel, so I search and find the panel with the "Goofy" tag, I empty it with RemoveAllViews and finally I remove the panel itself, with RemoveViewFromParent.
Once this is done, however, the header no longer seems to have a "layout", the text remains but not the initial colored and "bordered" rectangle. The worst thing is that when you click on it, the project crashes, because Row in this line (B4XTable source code) do not contains a number:
B4X:
Private Sub CellClicked (pnl As B4XView, LongClicked As Boolean)
If DateTime.Now < LastCellClickEvent + 20 Then Return
LastCellClickEvent = DateTime.Now
Dim column As B4XTableColumn = pnl.Parent.Tag
Dim Row As Int = pnl.Tag - 1 ' <----
I know this is hard to understand.
I hope for Erel's great intelligence (I'm very envious? [really, I'm not kidding]) and tomorrow or maybe sooner I'll attach an example.
[Too bad today is Friday (I don't specify the reason for this)]
[BTW] To test, I loaded the B4XTable source and all its dependencies, including the layout file. Strangely, the cells remain empty. I saw that the problem depends on AddNonQueryToBatch, but I didn't investigate further.