B4J Library [B4X] [XUI] SD FlexGrid (Table)

calloatti

Member
Licensed User
I have replaced several B4XTables with FlexGrids. What a wonderful library. Thank you. May I suggest a few things that would be great to have at some point.

1. The selected row highlight color cannot be changed, it would be nice to be able to change it. For example in the first image the second row is selected. The second image is the result of handling setting highlighted rows using a helper class, but being able to change the highlight color would simplify things a lot.



2. There is no way to change the border color of the header, it seems the header text color is used. Again, the result can be seen in the previous images. Also it seems that the borders of the header are thicker that the borders of the rows?

3. There is no way to add left/right padding for the cell text. I implemented padding by adding spaces before/after the cell text in the helper class, considering the column alignment.

4. There is no way to set the alignment of the header cells text.

5. I could not find a way to set some grid colors programatically. Those can be set in the designer. It would be great to be able to change the colors programatically. Maybe a setcolors method?

6. A SetRow(row, Cell As Object()) method could be a nice addition, to easily update rows without having to update each row cell. The use case is when you have a cursor with unknown changes and it would be easier to just update each row instead of every cell of every row.

7. (very minor and low priority) Make ColsAlignment and SetColAlignment accept "L", "C", "R" in addition to "LEFT","CENTER","RIGHT"

Again, thank you for this class. The main reason I switched from B4XTable if the ability to scroll down.
 

bleber

Member
Hi,
There are some method to search in list items when enter initial characters for an item.
Thanks.
 

Star-Dust

Expert
Licensed User
Longtime User
Currently you can search for exact text or text contained within the cell. (See exactly parameter)
But there is no search for a text starting with a specific string.

SearchInColumn (Text As String, Col As Int, FromRow As Int, exactly As Boolean, IgnoreCap As Boolean) As Int
 

pliroforikos

Active Member
Licensed User
Hello, i wonder if i can set the alligment of headers in B4i.

There is a function
  • setHeaderAlignment(ColumnIndex As Int, Alignment As String) As String
    eg. setHeaderAlignment(0,"CENTER")
but i don't know how to use it.
thank you
 

Star-Dust

Expert
Licensed User
Longtime User
Hello, i wonder if i can set the alligment of headers in B4i.

There is a function
  • setHeaderAlignment(ColumnIndex As Int, Alignment As String) As String
    eg. setHeaderAlignment(0,"CENTER")
but i don't know how to use it.
thank you
The first parameter is the column number to which you want to change the alignment (starts from zero) and the second parameter is a string which can be CENTER / LEFT / RIGHT
 

Star-Dust

Expert
Licensed User
Longtime User
Update 0.34
  • Added the ability to freeze the last row (foot row) as well as the header so you can enter column totals that always remain visible.
    It is possible to enable by code and by design. Choose text and background color
  • fix minor bugs

Attachment example 5
 

Attachments

  • Sample5.zip
    78.5 KB · Views: 195
Last edited:

hazaal

Member
Licensed User
Longtime User
Sorry if this sounds a bit stupid question, but is it possible to get a height of the row(s)? I need to be able to change FlexGrid height after some items have been added. Items are multirow text (one to 5 rows typically).
 

Star-Dust

Expert
Licensed User
Longtime User
The question is not clear to me. Do you want to know how many dots the height of a multi-line text is?

The height of the row is always the one set, it doesn't change if you put a text with several lines.
 

hazaal

Member
Licensed User
Longtime User
The question is not clear to me. Do you want to know how many dots the height of a multi-line text is?

The height of the row is always the one set, it doesn't change if you put a text with several lines.
Hi and thank you for your fast reply,

Yes, that is what I would like to know, but of course FlexGrid should support text wrap + autosize, or I should know how to calculate text height from it's canvas. Well, I don't, and from your answer I am sensing that wrap+autosize isn't available?

I guess I have to take a look CustomListView, I was just hoping to manage with FlexGrid since it's so straightforward in every other way I am using list/grid here.
 

Star-Dust

Expert
Licensed User
Longtime User
There is no autosize available. You could measure the text with the command with B4CCanvas and then change the line height. I have no other solutions at the moment
 

David Hawkins

Active Member
Licensed User
Longtime User
Hi Star-Dust good grid but I wondered if the Sorting problem had been resolved i.e. not removing duplicates
 

Star-Dust

Expert
Licensed User
Longtime User
Hi Star-Dust good grid but I wondered if the Sorting problem had been resolved i.e. not removing duplicates
Hi,
I didn't quite understand the question. Is it about the sorting that's giving you trouble? I'm not aware of any sorting issues.
Or are you talking about something else?
 

David Hawkins

Active Member
Licensed User
Longtime User
Hi Star-Dust I have implemented your Flexgrid and when I try to sort on various columns it removes all the duplicates, this is the code I use.

Flexgrid sorting:
Private Sub FlexGrid1_HeadClick(Index As Int)
    Try
        FlexGrid1.SortForCol(Index)
    Catch
        Log(LastException)
    End Try
End Sub
 

Star-Dust

Expert
Licensed User
Longtime User
I'll try with an example.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…