Для Slickgrid,
Обычно вы можете установить обратный вызов dateFormatter
таким образом в columns
переменных.
var columns = [
{id: "finish", name: "Finish", field: "finish",
formatter: dateFormatter, // path callback name to table
sortable: true }
];
function dateFormatter(row, cell, value, columnDef, dataContext) {
return value.getMonth() + '/' + value.getDate() + '/' + value.getFullYear();
}
Теперь я создал класс, который содержал член и метод, относящиеся к обработке таблицы.
Затем я хочу поймать dateFormatter
обратный вызов в методе класса. Как установить обратный вызов ??
class Table{
constructor(){
this.columns = [
{ id: "finish", name: "Finish",
field: "finish",
formatter: `this.dateFormatter`}, // it doesn’t work
];
this.data = new Array();
this.dataView = new Data.DataView();
this.grid;
}
makeGrid(gridName){
this.grid = new Grid(gridName,
this.dataView,
this.columns,
this.options);
}
dateFormatter(row, cell, value, columnDef, dataContext) { // want to catch here.
return value.getMonth() + '/' + value.getDate() + '/' + value.getFullYear();
}
}