Hi all, I read 'row grouping' example but for my case, I've any employees for each of these any timetable ... my query is a normal >INNER JOIN< for goup on employees ?
I'm not sure how you are looking to modify the row grouping demo. It might be fairly instructive to disable Javascript on that page, see how the grouping is done, and then re-enable Javascript to see the effect. Basically the first column (the browser engine) is the group, and that is always sorted upon first (before user sorting) by using aaSortingFixed. Remember an Inner Join doesn't mean anything to DataTables - it's how the data is presented to it, since it doesn't directly interface with SQL itself (there must always be PHP or something in the middle).
I'm not sure how your SQL is going to be working (the inner join etc), but as long as you output the HTML required, than DataTables can do the row grouping, as shown in my example. Have you tried disabling Javascript to see how my table is built up (or just 'view source')? From there, my code might make a bit more sense. Also aaSortingFixed is the key thing for controlling the sorting here - have a look at the documentation ( http://datatables.net/usage/options#aaSortingFixed ).
Hi allan now it's all ok .... or almost. In firefox ok in IE8 return a error (warning, added data does not match etc...), my json string is valid (with jsonlint) .... where's the problem ?!
Replies
I'm not sure how you are looking to modify the row grouping demo. It might be fairly instructive to disable Javascript on that page, see how the grouping is done, and then re-enable Javascript to see the effect. Basically the first column (the browser engine) is the group, and that is always sorted upon first (before user sorting) by using aaSortingFixed. Remember an Inner Join doesn't mean anything to DataTables - it's how the data is presented to it, since it doesn't directly interface with SQL itself (there must always be PHP or something in the middle).
Regards,
Allan
P.S.
If in my case column for group is not the first but the second ? Where I change the index ?
thanks
I'm not sure how your SQL is going to be working (the inner join etc), but as long as you output the HTML required, than DataTables can do the row grouping, as shown in my example. Have you tried disabling Javascript to see how my table is built up (or just 'view source')? From there, my code might make a bit more sense. Also aaSortingFixed is the key thing for controlling the sorting here - have a look at the documentation ( http://datatables.net/usage/options#aaSortingFixed ).
Regards,
Allan
my json string:
{"sEcho": 1, "iTotalRecords": 13, "iTotalDisplayRecords": 13, "aaData": [ ["Mister_x","01-07-2008","31-01-2010","durata_x"]] }
my table (thead) structure:
[code]
User
start
end
Duration
[/code]
datatable (aoColumns) option:
"aoColumns":
[
{ "bVisible": false },
null,
null,
null
]
==============================================
thanks
in datatable parameters:
[code]
"aoColumns": [
{ "bVisible": false },
null,
null,
null
],
"aaSortingFixed": [[ 0, 'asc' ]],
"aaSorting": [[ 0, 'asc' ]], // <---- comment this useless line
"sDom": 'lfr<"giveHeight"t>ip',
"bProcessing": true,
"bServerSide": true,
[/code]
byez