Set name to column from ajax and send to ajax on sort

Set name to column from ajax and send to ajax on sort

bonikbonik Posts: 1Questions: 0Answers: 0
edited March 2014 in General
Hi,
i have a dynamic datatable with dynamic headers, for example, i select my table headers from the database( headers = ).
now, im trying to sort this headers with ajax request. im getting the 'iSortCol_0' to my server-side script with the position number of the header.
i want to set a name for the header so i could recognize him on my server-side script.
i tried to set "sTitle" but unfortunately it does not send me the sTitle of the particular column that being sorted.
here is my JSON:
[code]
aaData:[..........]
aoColumns: [{sTitle:CheckBox}, {sTitle:FullName}, {sTitle:Email}, {sTitle:Phone},…]
0: {sTitle:CheckBox}
1: {sTitle:FullName}
2: {sTitle:Email}
3: {sTitle:Phone}
4: {sTitle:56DDC6E0-6BA2-25DF-8FC5-2FA0D3110D72}
5: {sTitle:09BC4917-867A-E916-890F-1D249E863C14}
6: {sTitle:Created}
7: {sTitle:Edit}
8: {sTitle:Delete}
iTotalDisplayRecords: 3
iTotalRecords: 3
sEcho: 1
[/code]

any ideas??

thank you!!!!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    This is discussed in a number of other threads. Currently, there is no method to pass column information before in the Ajax data source, since JSON cannot represent the full range of options available.

    If you want to get the column information from an Ajax source, you need to make the Ajax call, construct the table and then initialise DataTables.

    There should be nothing in the documentation suggesting that what you have tried is possible, and if there is, it would be great if yo could let me know where so I can remove it.

    Allan
This discussion has been closed.