Is there a way to have a column display a date as DD MMM YYYY and the searchpane display only YYYY?
Is there a way to have a column display a date as DD MMM YYYY and the searchpane display only YYYY?
badijd
Posts: 9Questions: 4Answers: 0
Currently call a function to format a date column.
if (type == 'display') {
return moment(data).format('DD MMM YYYY');
}else if (type == 'filter') {
return moment(data).format('YYYY');
}
The searchpanes does combine the dates into YYYY but uses the first record day and month values to display in the pane (odd behavior). How do I only display YYYY in the searchpanes?
Answers
SearchPanes uses the cell's display to build the list used for the SearchPane table. You can use orthogonal data to change the SearchPanes display, see this example. I built an example, based on your above code to show how this works with
columns.render
.https://live.datatables.net/vibubuzu/1/edit
Kevin