datatables - Manipulate column in datatable row
问题描述
I m using datatable to load data from the database. there is a datetime
column that I want to Manipulate. So basically I want to use moment-js and convert datetime
into the user's locale time and etc.
I tried createdRow however that event is called after data has been inserted into the rows.
is there beforeCreatedRow row type event so that I can Manipulate data before inserting it into a row?
$("#ronin").DataTable({
"order": [
[0, "desc"]
],
ajax: {
url: "r1.php",
dataSrc: ''
},
colReorder: {
realtime: true
},
createdRow: function(row, data, dataIndex) {
console.log(data.datetime);
return data.datetime = '2222-22-22 11:11:11'//test
},
"aoColumns": [{
data: 'id'
},
{
data: 'seed'
},
{
data: 'useragent'
},
{
data: 'ip'
},
{
data: 'datetime'
}
]
});
here is the code.
thank you.
解决方案
推荐阅读
- c++ - Clang++/g++ 不在 Aarch64 上矢量化代码
- smartsheet-api - 我是否需要生成新令牌才能查看新的智能工作表数据
- python - 从字符串中的单词列表中查找第一个匹配项
- javascript - Service Worker 没有在 Angular 中注册
- nginx - 使用 nginx 代理动态进入 Kubernetes 服务
- django - Django could not open images
- r - lm(线性回归)函数生成不可移除的异常值
- php - Compare multidimensional array values by key in php
- javascript - Vuejs如何将点击功能设置为语义UI的关闭功能?
- java - Java ee Servlet 正在处理 AbstractMethodError