New react version!!! how to create a serverside ajax query?
New react version!!! how to create a serverside ajax query?
willgart
Posts: 1Questions: 1Answers: 0
Hi,
just found that datatables.net has now a React component available.
any sample on how to setup it for a serverside ajax access?
in JQuery I'm using a code like this:
table = $("#dataTable").DataTable({
....
ajax: {
url: surl, // URL of your Azure Function
type: 'POST', // Use POST method to send data
headers: { "Authorization": "Bearer " + lbearer },
data: function (data) {
data.length = 5000;
data.search = { "value": "", "regex": false, "fixed": [] };
data.draw = 1;
return JSON.stringify(data);
},
},
});
how to create this code in React?
I see the ajax property in the DataTable component, but not sure how to implement it.
any sample?
thanks.
Answers
Probably easiest to have it as a property:
You could do it inline with the JSX, whatever you prefer.
Allan