Displaying a table of results from a dataset

I have a simple dropdown list that when an item is selected, it returns a table of results from a dataset.

Is it possible to span a row header to cover multiple colums? eg. I have 5 colums in my dataset each with a different ‘specialism’ but I would like these to be displayed under one header column?

I only have limited coding experience so for now I am just using the following and repeating to display the other columns.

$w.onReady( function () {
$w(“#table1”).columns = [{
“id”: “col1”,
“dataPath”: “specialism”,
“label”: “Specialism”,
“width”: 80,
“visible”: true ,
“type”: “string”,
},
];
});

Many thanks!

What you want is possible, but is not a trivial task. It will require coding.

You can use the results of a database query to create the Table.rows that will be displayed in the table. In this way you can build whatever content for the fields that you want.

Another possible way would to use an afterQuery() database hook that could manipulate the results based on the code that you provide for the hook function.

Good luck,

Yisrael

Many thanks, Yisrael. Would you be able to provide me with an example using table.rows to create something like this…


Many thanks!

You can create the header by using text boxes placed at the top of the table.