Combine custom redering with sort from data
Combine custom redering with sort from data
Hello World,
due to too much data I have to switch from HTML to AJAX. Now I am stuck with the following problem.
I have figured out different ways to sort and show.
My data here
{
"data": [
{
sku" : { "sort" : "6003428013000",
"url" : "ViewProduct-Start?SKU=600342-8013-000&ExtendedNavigation=true"
"display : "Lorem text"}
}
]
}
I want this with the "sort" value, but i don't know how to receive it from my data.
"columns": [
{
"data": "sku",
"render": function (data) {
return "<a href='" + data.url + "'>" + data.display + "</a>";
}
}
]
This example shows how to reach to the data, but here i can't rendered it properly.
"columns": [
{
"data": "sku",
"render": {
"_": "display",
"sort": "sort"
}
}
]
Alternative question: or is there a way to create html-data-attributes into the respective cell ?
<td data-dt-filter-attribute="availability" data-sort="2">
Thanks in advance.
Answers
My understanding it the HTML5 data attributes for data-sort, etc don't work with Ajax loaded data.
Have you tried using
columns.render
for the orthogonal data similar to what is shown in the computed example.Maybe something like this:
Note the additional type and row parameters. Also when using something like
"data": "sku",
you need to use the row parameter to access the other row data.Kevin
Thanks mate for your help.