[FREE] TableViewer - fully style customized to show table data

@Kevinkun : I solved it now by still using AnyTableViewer, but I am using now SetStyleSheet (instead of SetStyle) and it works great. I post all my CSS content into it, like e.g.:

table { border-collapse: collapse; width: 100%; }
th { text-align: right; }
th:nth-of-type(2), th:nth-of-type(3), th:nth-of-type(11) { text-align: left; }
td { text-align: right; border: 1px solid black; padding: 2px; }
td:nth-of-type(2), td:nth-of-type(3), td:nth-of-type(11) { text-align: left; }

1 Like

@Kevinkun
regarding the sticky header row, the example you showed in comment #1 does not work for me:

My screen consists of a huge vertical scroll arragement, therefor I think the whole layout with the tableviewer including the header row just scrolls "away" :wink:

I assume your example is only feasible if the screen and/or underlying arrangement are NOT scrollable and tableview-layout IS scrollable? Could that be?

I am not with my computer.
You can try with a non scroll layout, and let us know the difference.

5 posts were split to a new topic: Help me, how to make a list of list?

I might do if I find time, as I would need to start a new project from scratch.
With my current project, I do not want to play around.
Cheers, Oli

This works

TVScrolling.aia (31.6 KB)

Notes:

  1. A fixed height for the VA containing the tableviewer, less than the height of the tableview, to make it scroll.
  2. When testing with emulator on computer, and scrolling with the mouse wheel, will not scroll past the tableview, until it has scrolled the tableview (as expected...). Probably similar behaviour with a finger.
2 Likes

@rkuba
V5 is available, OnScroll event is added.
Snipaste_2023-03-10_11-28-49
this will return the top-left cell's row and col. The cell need to be totally in the view.

2 Likes

@Kevinkun : I use in my project the same tableviewer in the same layout. At first, the table gets loaded at app startup with ~50 lines and displayed perfectly. Then, after a click on a button, the data is much less, but as I said, i pass that data into the same tableviewer in the same layout. BUT the room that is reserved on the screen for the table is then still the same as when the app loads. So reducing the amount of lines does not lead to a smaller hight of the layout. I do make a new INIT at button.click, but does not change the above behaviour.
Can you please explain how I can achieve that? Is INIT not the right step to do so? Thank you!
KR, Oli

Use the ClearTable block? You should not need to init again.

I have replicated what you reported, only if you set the container's height as automatic.
Maybe I can add a runjs function, you can get the height of the table by js, then adjust the container's height if needed.

Hi guys (@TIMAI2 and @Kevinkun).
ClearTable sounded like a good idea, but it did not help unfortunately.
Yes, my container (an vertical arrangement) is set to height=automatic.
After reducing the amount to rows to be displayed, space is not adjusted to the new height.
But I would not see any other alternative than height=automatic.
And to display the table in a VA is also correct, right?

ClearTable doesn't change anything, but using .Init layout fixes it for me....

made a video, first run through is without init, second run through with init.

image

2 Likes

You are right! Works for my now also with .Init.
Previously, I tried to make the init somewhere else in my loop and there it did not work strangly.
But now it is fine, even with height=automatic.
Thanks!

Hello

How do you add to the tableview?
This is an example of what I have been trying.

This work
Populate

This is what I have a problem with will not add the next row.

Thank you

item of the match_a_stat should be a list .now you add a string to it.

Hello

You mind showing an example? I am not understanding

Thank you

Hello

Ok now I am getting an error

Added list from csv row text

Error

Than you for your help

I think your misunderstanding is that you want to use "list" like a database or like a table, but a list only can hold 1 set of values, comma-seperated. One "row" basically.

I think, you should start using a database like TinyDB to store your entries.
Then loop over that database to read those entries and move them to the Tableviewer.

remove \n from the Join block.