Ideal way to conditionally not display a row

Ideal way to conditionally not display a row

vishalashahvishalashah Posts: 3Questions: 2Answers: 0

The data that we set in the datatable has parent and child row data in a flat 2D array with row and parentid supplied for each data element as below:

rowid -> 1, parentid -> -1
rowid -> 2, parentid -> -1
rowid -> 3, parentid -> 3
rowid -> 4, parentid -> 3
rowid -> 5, parentid -> 3
rowid -> 6, parentid -> -1

Elements that have a parentid = -1 or parentid = rowid are displayed during all processes. Elements where parentid is greater than -1 and parentid not equal to rowid they are displayed as child records when that particular parent row is clicked.

Any suggestions how we can achieve this in DataTables.

We have been trying to remove row is drawCallback for the current page, however since we have paging there are instances when the first 50 records returned in the dataset are children and so we get a blank page.

We also tried to do the same in preDrawCallback where we work on the full dataset not exceeding 1000 records and remove rows, however this affects the performance of the datatables as this function is called in each preDraw.

This discussion has been closed.