Adding custom config variables to a server side response...

Adding custom config variables to a server side response...

hb2brandonhb2brandon Posts: 6Questions: 0Answers: 0
edited April 2014 in DataTables 1.9
I'm trying to make ColumnFilter pull a list of distinct database values to fill select boxes. Working backwards and search the forums I believe I know what I have to do. (see Allan's 2nd comment here: http://www.datatables.net/forums/discussion/3931/server-side-filtering-on-specific-columns-with-input-and-select/p1)

I'm getting held up on accessing the data I've added. I created an array called 'filterLists' and want to override the data being sent to the select box drawing function if mData is a member of filterLists.

The only part I can't figure out is how to access filterLists once the ajax feed is digested by dataTables. Do I need to declare it somewhere (I've tried but can't access it or find it with a console.log)? What would the syntax be to reference it?

Replies

  • allanallan Posts: 63,576Questions: 1Answers: 10,483 Site admin
    If you are using 1.9.4 or earlier look at fnServerParams . For 1.10+ use `ajax.data` .

    Allan
  • hb2brandonhb2brandon Posts: 6Questions: 0Answers: 0
    Using 1.9.4...

    Ok... so I can use that when the json response is first parsed to declare/push and fill the variable with a piece of the json response.

    Is it not obtainable at all directly? I've pretty much butchered ColumnFilters.js to suit my every need but so far I haven't had to modify the core. Am I wrong or will I have to in order to push my array into an accessible space?
  • allanallan Posts: 63,576Questions: 1Answers: 10,483 Site admin
    I'm a bit confused I'm afraid. Is what not obtainable directly? The data object sent to the server? That's what the fnServerParams public interface is for.

    Allan
This discussion has been closed.