table component - foundset by query

Hi all,

I’m using the table-component in Servoy 2020.03 and it it woking really well when I bind it to the form foundset or a related foundset.
However, I have a table where I’d like to load news stories. To generate the list I use the following query:

var query = "SELECT id FROM news_articles WHERE news_articles.tsv @@ to_tsquery(?) ORDER BY pub_date";

on a normal form I can simply do

forms.news.foundset.loadRecords(query, args);

The table component has a foundset but this looks like a foundset setter, not a full foundset node.
The component also has what seems to be a callback,

onViewPortChanged(start, end)

How do I put this together? What kind of foundset do I need to use?
Does anyone have a snippet of sample code showing how this is all put together?

Thanks,

Christian

You are talking about the servoy-extra table component right? So the name of it’s foundset property is “foundset”.
You should be able to access that (assuming the table already has a foundset) directly through:

elements.myExtraTable.foundset.foundset.loadRecords(query, args);

More details on how to use foundset typed properties from scripting and how to assign new foundsets to an existing property or complete new foundset property values can be found here: https://wiki.servoy.com/display/DOCS/Fo … ertyaccess

elements.myExtraTable.foundset.foundset.loadRecords(query, args);

I noticed I could do this, bit U thought the foundset.foundset bit of syntax was very odd, so I did not persue it…

One warning about the servoy-extras table component in case someone else gets into trouble:

Do not try to hide the header by using css like this (mine has a style-class called news-table):

.news-table>thead>tr  {
	height: 0px;
}

If you do this the table stops redrawing. I have been debugging my screens for a day going around in circles before realising this.
If you add a little height on the header everything works fine:

.news-table>thead>tr  {
	height: 2px;
}