Skip to content

Attach data to server-side request #1525

Answered by shanmukhateja
XDavidT asked this question in Q&A
Discussion options

You must be logged in to vote

One way to do it would be to hitch the columns to individual variables and bind them with ngModel. Later, in your Ajax call, add them as a property to dataTableParameters.

Example:

export class SomethingComponent {

// Step 1: Setup variables to all column inputs that user can toggle.

  searchDateField1 = new Date(); // or what have you
searchField2 = 'All' // you get the idea


// Step 2: Hitch the variables to AJAX call inside `dtOptions`

// inside init object
this.dtOptions = {
 // blah blah
ajax: (dataTableParameters, callback) =>{

  // here we go!
dataTableParameters.myData = {
 searchDateField1: this.searchDateField1,
searchField2: this.searchField2
};

// HTTP POST request
this.d…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by XDavidT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants