layui.use(['table','jquery','form','util'], function(){
var form = layui.form;
var table = layui.table;
var $ = layui.jquery;
var util = layui.util;
//第一个实例
table.render({
elem: '#demo'
,toolbar:'#toolbarDemo'
,limits:[1,2,4,6]
,limit:10
,cellMinWidth:90
,url: '/Question/ShowQuestion' //数据接口
,page: true //开启分页
,cols: [[ //表头
{field: '', title: '', type:'checkbox' , fixed: 'left'}
,{field: 'id', title: 'ID', edit: true}
,{field: 'question', title: '问题内容', edit: true}
,{field: 'create_time', title: '提问时间',templet: function(d) {return util.toDateString(d.create_time*1000);},edit: true}
,{field: '', title: '操作', toolbar:'#barDemo' , fixed:'right'}
]]
});
注意:
layui.use(['table','jquery','form','util'], function(){
var util = layui.util;
,{field: 'create_time', title: '提问时间',templet: function(d) {return util.toDateString(d.create_time*1000);},edit: true}