
|
If you were logged in you would be able to see more operations.
|
|
|
|
Data table column def should support types, like date, number, currency. Need to incorporate these into the DataTable and add formatters for them.
|
|
Description
|
Data table column def should support types, like date, number, currency. Need to incorporate these into the DataTable and add formatters for them. |
Show » |
|
def dataTableDataAsJSON = { def list = [] if (params.sort == 'crap') params.remove('sort') def demoList = Demo.list(params) response.setHeader("Cache-Control", "no-store") demoList.each { list << [ id: it.id, name: it.name, birthDate: grailsUITagLibService.dateToJs(it.birthDate), age: it.age, netWorth: it.netWorth, isDumb: it.isDumb, dataUrl: g.createLink(action: 'dataDrillDown') + "/$it.id" ] } def data = [ totalRecords: Demo.count(), results: list ] render data as JSON }As you can see, you send the 'birthDate' Date object into "dateToJs", and it will transform it into a string that will be recognized by the DataTable as a date in the view, and pulled back out into a JavaScript Date object for formatting.