效果图:
var myFormatter = { setBackgroundColor: function (sValue) { var id = this.getId(); var $elm = $('#' + id); var className = this.data('color'); $elm.closest('td').addClass(className); return sValue; } }
xxx.view.xml
<Table ...> <columns> <Column hAlign="Center" resizable="false"> <multiLabels> <m:Label text="Today" textAlign="Center" width="100%"/> </multiLabels> <template> <m:Label app:color="red" text="{ path: '/Today', formatter: 'myFormatter.setBackgroundColor' }"/> </template> </Column> ... </Table>