Sorting Server-side when the iSortcol =/= aColumn array position
Sorting Server-side when the iSortcol =/= aColumn array position
So i have an app that will show an html table to the client on one page, and in the admin area, show the same html table with additional columns
for instance:
client table has the columns id, date, description, in that order
admin table has the columns id, owner, date, description, in that order
(i can provide the html , but trying to save space)
now i am using the same datatables server-side script to populate both tables, i figure why repeat myself, right? I use different parameters as needed, but it's essentially querying the same exact table
here's an example of $aColumns (PHP)
[code]$aColumns = array( 'ID, 'OWNER', 'DATE', 'DESCRIPTION');[/code]
When i attempt to sort the admin table, everything is ok, however
when i attempt to sort the client table on the date column, it sorts by the owner column instead. It sends the param as iSortcol=1 because date column index is 1. The script receives the param,and the sort is on the owner column (position #1 in the array) and not the date column
The fact im staring down is that having multiple tables utilizing the same server-side script would require me to make sure all html table columns were in the exact same order, and some views having different columns than others almost couldnt be possible to sort on
Is this the case or am i missing a vital piece that will make all my problems go away and give me rainbows?
for instance:
client table has the columns id, date, description, in that order
admin table has the columns id, owner, date, description, in that order
(i can provide the html , but trying to save space)
now i am using the same datatables server-side script to populate both tables, i figure why repeat myself, right? I use different parameters as needed, but it's essentially querying the same exact table
here's an example of $aColumns (PHP)
[code]$aColumns = array( 'ID, 'OWNER', 'DATE', 'DESCRIPTION');[/code]
When i attempt to sort the admin table, everything is ok, however
when i attempt to sort the client table on the date column, it sorts by the owner column instead. It sends the param as iSortcol=1 because date column index is 1. The script receives the param,and the sort is on the owner column (position #1 in the array) and not the date column
The fact im staring down is that having multiple tables utilizing the same server-side script would require me to make sure all html table columns were in the exact same order, and some views having different columns than others almost couldnt be possible to sort on
Is this the case or am i missing a vital piece that will make all my problems go away and give me rainbows?
This discussion has been closed.