Sub B4XTable1_DataUpdated
For row = 0 To B4XTable1.VisibleRowIds.Size - 1
For Each col As B4XTableColumn In B4XTable1.Columns
Dim pnl As B4XView = col.CellsLayouts.Get(row)
If row = 0 Then
pnl.SetColorAndBorder(xui.Color_Gray, 0dip, xui.Color_Transparent, 0dip)
Else
Dim background As Int = IIf(row Mod 2 = 0, B4XTable1.EvenRowColor, B4XTable1.OddRowColor)
pnl.SetColorAndBorder(background, 0dip, xui.Color_transparent, 0dip)
End If
Next
Next
End Sub
B4XTbl1.Clear
B4XTbl1.GridColor = xui.Color_Transparent
This works for me. I hope it works for you if nobody can give you a simpler and a more obvious solution.
B4X:Sub B4XTable1_DataUpdated For row = 0 To B4XTable1.VisibleRowIds.Size - 1 For Each col As B4XTableColumn In B4XTable1.Columns Dim pnl As B4XView = col.CellsLayouts.Get(row) If row = 0 Then pnl.SetColorAndBorder(xui.Color_Gray, 0dip, xui.Color_Transparent, 0dip) Else Dim background As Int = IIf(row Mod 2 = 0, B4XTable1.EvenRowColor, B4XTable1.OddRowColor) pnl.SetColorAndBorder(background, 0dip, xui.Color_transparent, 0dip) End If Next Next End Sub
Yes, I have followed this.The position of the gridcolor setting in your code seems to matter (before filling the table).
View attachment 142785B4X:B4XTbl1.Clear B4XTbl1.GridColor = xui.Color_Transparent
I forgot that you are working in B4J environment. Here is an extensive testing in B4J. It seems to be working as desired. No gridlines on the header and no gridlines in data rows. Please do me a favor and test it in your B4J even if you decide to abandon the idea:I will try play around
For Each col As B4XTableColumn In B4XTable1.Columns
Dim pnl As B4XView = col.CellsLayouts.Get(0)
pnl.SetColorAndBorder(xui.Color_Gray, 0dip, xui.Color_Transparent, 0dip)
Next
Sub B4XTable1_DataUpdated
For row = 0 To B4XTable1.VisibleRowIds.Size - 1
For Each col As B4XTableColumn In B4XTable1.Columns
Dim pnl As B4XView = col.CellsLayouts.Get(row+1)
Dim background As Int = IIf(row Mod 2 = 0, B4XTable1.EvenRowColor, B4XTable1.OddRowColor)
pnl.SetColorAndBorder(background, 0dip, xui.Color_transparent, 0dip)
Next
Next
End Sub
I have tested your code above. It seems the behaviour is the same.I forgot that you are working in B4J environment. Here is an extensive testing in B4J. It seems to be working as desired. No gridlines on the header and no gridlines in data rows. Please do me a favor and test it in your B4J even if you decide to abandon the idea:
Place this code after you define the columns:
B4X:For Each col As B4XTableColumn In B4XTable1.Columns Dim pnl As B4XView = col.CellsLayouts.Get(0) pnl.SetColorAndBorder(xui.Color_Gray, 0dip, xui.Color_Transparent, 0dip) Next
B4X:Sub B4XTable1_DataUpdated For row = 0 To B4XTable1.VisibleRowIds.Size - 1 For Each col As B4XTableColumn In B4XTable1.Columns Dim pnl As B4XView = col.CellsLayouts.Get(row+1) Dim background As Int = IIf(row Mod 2 = 0, B4XTable1.EvenRowColor, B4XTable1.OddRowColor) pnl.SetColorAndBorder(background, 0dip, xui.Color_transparent, 0dip) Next Next End Sub
One way to find out is if you export a small project without disclosing sensitive data that shows the problem on your computer and we can test it for you with the code I posted in post #10. I have tested it extensively in B4J and B4A and with several databases and apps. It worked the way it is supposed to every time. I even tested it with a table that has 11 columns.I have tested your code above. It seems the behaviour is the same.
One way to find out is if you export a small project without disclosing sensitive data that shows the problem on your computer and we can test it for you with the code I posted in post #10. I have tested it extensively in B4J and B4A and with several databases and apps. It worked the way it is supposed to every time. I even tested it with a table that has 11 columns.
Have you tested with different screen resolution?I believe this happen in my Windows with wide screen display and high resolution (1920 x 1080).
Have you tested with different screen resolution?
I will try to create one but I am strongly believe that it is my PC problem.Yes, tested on these resolutions on PC 1920x1080 and also 1289x1024. I also tested it on a samsung phone with: 2280x1080. Worked fine. That is why you need to export a sample project so members can test it for you at whatever resolution they have. If you can't, good luck.
View attachment 142814
Thanks for trying out.I added some code to your project. Here is attached the B4X project. You can run it in either B4A ( tested on OS 8.1 and OS 11) or B4J ( tested on a PC). The code removes all gridlines. All works for me as expected. This is as far as I am going with this. If that is not what you want, just toss it.