How to search on rendered data with server side
How to search on rendered data with server side
raf_mix
Posts: 12Questions: 3Answers: 0
Hi,
I use dates on a column. The dates are formatted as date in mysql (YYYY-MM-DD)
I diplay the date with a local format by using moment.js.
My issue is that the search is based on mysql value not on rendering.
I cannot use Orthogonal data as it's server side version.
I tested a render function like:
language: { url: "../assets/js/locale/French.json" },
"columns": [{
"data": "day",
"className": "text-right",
render: function(data, type, full, meta) {
if (type == 'display') {
if (data) {
return moment(data).format("Do/MM/YYYY");
}
}
if (type == 'sort') {
if (data) {
return data;
}
}
if (type == 'search') {
if (data) {
return moment(data).format("Do/MM/YYYY");
}
}
return data;
}
},....
but it don't work, any solution?
Thanks in advance
raph
Answers
removed
The rendering is done client-side, but the searching is done server-side if
serverSide
is set, so your server-side scripts would need to either send the data in that rendered format, or apply a similar render when considering the search results,Colin
Hi, thank for the anser.
I still tested with "serverSide: false" but in this case I have an empty table.
raf
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin