niiknow / vue-datatables-net

Vue jQuery DataTables.net wrapper component
https://niiknow.github.io/vue-datatables-net/
MIT License
171 stars 58 forks source link

How to Send Customs parms on every reload #63

Closed sainani8897 closed 2 years ago

sainani8897 commented 3 years ago

I want to send custom query params to data but anyhow it always sends params that were initialised earlier i wasn't able to update the parameters any help?

noogen commented 3 years ago

Datatables.net is a jQuery component; as such, you have to modify request it before it is sent. This is similar to sending additional headers here: https://github.com/niiknow/vue-datatables-net#additional-headers

// generic jquery example
beforeSend: function(jqXHR, settings) {
    settings.data = $.extend(settings.data, {anotherParamter: 'test'});
    return true;
  }

// if sent as query string
beforeSend: function(jqXHR){
    this.data += '&' + $.param({
      anotherParamter: 'test'
    });
  }
noogen commented 3 years ago

A little more research and you can find it from the source. Here's the documentation: https://datatables.net/examples/server_side/custom_vars.html Example: https://datatables.net/forums/discussion/23262/load-ajax-data-with-custom-parameters

noogen commented 2 years ago

Stale issue.