DataTable rowGroup doesn't work as I want
DataTable rowGroup doesn't work as I want
bplanet
Posts: 10Questions: 2Answers: 0
Hello,
rowGroup question.
This is DataTable Editor response:
{"data":[{"DT_RowId":"row_1","units":{"Title":"PGD Sostro","SectorTitle":"1. VZHOD","LastLocation":null,"CurrentLocation":null}},
{"DT_RowId":"row_1","units":{"Title":"PGD Sostro","SectorTitle":"1. VZHOD","LastLocation":null,"CurrentLocation":null}},
{"DT_RowId":"row_2","units":{"Title":"PGD Bizovik","SectorTitle":"1. VZHOD","LastLocation":null,"CurrentLocation":null}},
{"DT_RowId":"row_3","units":{"Title":"PGD Pre\u017eganje","SectorTitle":"2. ZAHOD","LastLocation":null,"CurrentLocation":null}},
{"DT_RowId":"row_3","units":{"Title":"PGD Pre\u017eganje","SectorTitle":"2. ZAHOD","LastLocation":null,"CurrentLocation":null}}],
"options":[],"files":[],"debug":[{"query":"SELECT `units`.`ID` as 'units.ID', `units`.`Title` as 'units.Title', `unit_sectors`.`Title` as 'unit_sectors.Title', (SELECT CONCAT(interventions.Street, interventions.StreetNumber, interventions.Municipality) FROM interventions LEFT JOIN interventions_units ON interventions.ID = interventions_units.InterventionID WHERE interventions.Status = 'finished' AND interventions_units.UnitID = '1' ORDER BY interventions.DateStart DESC LIMIT 1), (SELECT CONCAT(interventions.Street, interventions.StreetNumber, interventions.Municipality) FROM interventions LEFT JOIN interventions_units ON interventions.ID = interventions_units.InterventionID WHERE interventions.Status = 'active' AND interventions_units.UnitID = '1' ORDER BY interventions.DateStart DESC LIMIT 1) FROM `units` LEFT JOIN `interventions_units` ON `units`.`ID` = `interventions_units`.`UnitID` LEFT JOIN `interventions` ON `interventions`.`ID` = `interventions_units`.`InterventionID` LEFT JOIN `unit_sectors` ON `unit_sectors`.`ID` = `units`.`SectorID` WHERE `units`.`Status` = :where_0 AND `units`.`FireDepartment` = :where_1 AND `interventions_units`.`Status` = :where_2 ","bindings":[{"name":":where_0","value":"active","type":null},{"name":":where_1","value":"1","type":null},{"name":":where_2","value":"active","type":null}]}]}
I added this to DataTable instance
rowGroup: {
dataSrc: 'units.SectorTitle'
},
Result you can see on picture I attached.
Problem is I get two groups for 1. VZHOD.
Why this behavior accours?
Result I need must be like this:
VZHOD
PGD Bizovik
PGD Sostro
PGD SostroZAHOD
PGD Prežganje
PGD Prežganje
Best regards,
Žiga
This discussion has been closed.
Replies
You have have the table sorting on some other column. I would suggest using
order
ororderFixed
to set the sorting to be on the SectorTitle column.Allan
Thank you Allan, it works!