rowGroup - Display multiple column values in Group Header.
rowGroup - Display multiple column values in Group Header.
DTDev77
Posts: 4Questions: 2Answers: 0
Hello,
i got a datatable with rowGroup, using following code:
'rowGroup': {
startRender: function (rows,group ) {
return group;
},
dataSrc: [1],
},
This produces a Group like:
Name
Street | ID | Order
Street | ID | Order
Street | ID | Order
Street | ID | Order
And i want a group which looks like:
Name - Street - ID
Order
Order
Order
Order
How can i access the Data and how to modify the group header?
Best Regards,
DTDev
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You'd hide the street and id columns using
columns.visible
and you'd use therowGroup.startRender
to build the string that you want to display in the grouping row. There is an example of that here.Allan
Thank you,
Columns Visibile seems to be clear, start Render too, but i can't figure out how to access the data, it must be something like:
rows.data()
will give you the data for the rows in the group. So you could dorows.data().eq(0)
to get the data for the first row in the group.Then it depends on your data is an array or an object - if you use
columns.data
then most likely it is object based and you'd do something likedata.myProperty
or if it is array baseddata[0]
.Allan
That's was i needed,
many thanks!
I have a similar problem to the above. The data I'm trying to group comes from an array (the JSON the editor returns from the PHP script). The structure is below.
The column data is from a linktable. The column (arbitrarystamps) can have multiple entries. In the case of the above there is only one column entry but it's generated from a select multiple field. The column could also be blank.
If it helps the code to get the data to render in the column (which works) is
Is this possible please?