url:"${pageContext.request.contextPath}/emp/jsps.action",
type:"POST",
dataType:"json",
success:function(json){
console.info(json);
var newslist=json;
var info = {
cols: [ // 定义列
{ width: 50, text: '#', type: 'number', flex: false, colClass: 'text-center' },
{ width: 'auto', text: '名称', type: 'string', flex: false, colClass: '' },
{ sort: 'down', width: 120, text: '时间', type: 'date', flex: true, colClass: '' },
{ width: 100, text: '类型', type: 'string', flex: true, colClass: 'text-center' },
{ sort: false, width: 400, text: '描述', type: 'string', flex: true, colClass: 'nobr' },
{ width: 'auto', text: '评分', type: 'number', flex: false, colClass: 'text-center text-important' },
{ width: 60, text: '操作', type: 'number', flex: false, colClass: 'text-center text-primary' }
],
rows: [ json// 定义行
/*此行中的每一列数据存放在数组中,注意与列定义的顺序一致*/ ]
};
$('#datatableExample').datatable({
data: info,
checkable: true,
sortable: true,
fixedLeftWidth: '30%', // 左侧固定列总宽度
fixedRightWidth: '30%',
});
},
error:function(){
alert('服务器异常');
}
});
回贴