Add an extra parameter to request before calling fnDraw?

Add an extra parameter to request before calling fnDraw?

xabierxabier Posts: 11Questions: 0Answers: 0
edited January 2011 in General
Hello all,

Quick question. I've assigned a callback to the onclick of a button wich must reload the table (this is a serverside handled datatable) but I must add an extra parameter to the query before doing the ajax request.

What I have so far (after checking docs and forum) is:

[code]$('#highlightsBtn').click(function() {
oTable.fnSettings().aoData.push({"name": 'highlight', "value":'true'});
oTable.fnDraw();
});[/code]

but I'm getting an error in Firebug, I think I should do something else in order to properly add the parameter but I'm lost as to how.

Thanks in advance,

Xabier Burgos.

Replies

  • xabierxabier Posts: 11Questions: 0Answers: 0
    edited January 2011
    Isn't there a way of doing this? I've been searching the forums as well as the docs and I'm unable to find anything.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Yup - there is :-) http://datatables.net/examples/server_side/custom_vars.html

    Allan
  • xabierxabier Posts: 11Questions: 0Answers: 0
    edited January 2011
    Hi Allan,

    I've already done that but on top of it, I have a button that when cliked should trigger a reload (ajax request) of the table adding an extra parameter to that request. Is that possible?

    Thanks a lot,

    Xabier.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    I guess you will need to set some kind of flag somewhere which (global variable, or attached to DataTables object or whatever) will instruct the fnServerData function to add that extra information needed.

    Allan
This discussion has been closed.