Ajax and buttons : collection
Ajax and buttons : collection
Hello,
First I have a dt that is being filled by json from an SP call.
SmixTable = table.DataTable({
ajax: {
url: "service/CallSP.cs/CallsSPMethod",
contentType: 'application/json; charset=utf-8',
data: { xx: mId, xx: sId },
dataType: 'json',
},
columns: [
{ "xx": "xx" },
],
buttons: [
{
extend: 'collection',
text: 'xx'
buttons : [{}]
}
]
})
Just an example of my code. As you see the datatable is calling an SP via the method CallSPMethod. This method will return content for the whole table. I would like to fill my button with data from another SP. Is this doable in a neat way? Or will it end up as a hack?
edit: https://datatables.net/extensions/buttons/examples/initialisation/collections-autoClose.html
Like this I would like to fill the datatable with content from one ajax call and would like to fill the button in the links case "Table Control" with content from another ajax call
Br,
Anton
This question has an accepted answers - jump to answer
Answers
Hi @aelgh ,
That would be possible -
buttons.buttons.text
can be a function (see those examples), so it can get that text field from an Ajax call.Cheers,
Colin
Hey! @colin
Thanks for quick answer. Just by a quick look I think this is what im looking for! Cheers
Anton