2016-09-27 15:24:34
章
|
$.ajax({
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('服务器异常'); } }); |
sunhao
|
ZUI 数据表格动态加载数据的例子:
https://jsfiddle.net/catouse/9k9dgyqx/
|
sister
|
zui的数据表格太难用了。难上手,开发成本高。 楼上这为兄弟 ,你获取到数据后可以,
$ ( 'table.datatable' ). datatable ( 'load' ,info); |
1/1