datatable数据表格 json数据如何拼接到rows[]里面 湿了多次都没成功(下面是demo ajax请求)

zhangruilin 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('服务器异常');
          }
      });
回帖列表
murder 2017-12-04 18:39:06
兄弟 解决了吗  解决了发一下
sisterapple 2017-03-10 09:12:14
zui的数据表格太难用了。难上手,开发成本高。 楼上这为兄弟 ,你获取到数据后可以,
                $
                (
                'table.datatable'
                ).
                datatable
                (
                'load'
                ,info);
sunhao 2016-10-28 16:57:53
ZUI 数据表格动态加载数据的例子: https://jsfiddle.net/catouse/9k9dgyqx/
zzz799316652 2016-10-27 15:53:18
菜鸟路过,我也想知道,还在学习中
zhangruilin 2016-09-28 14:25:21
求大神指教   菜鸟一个
1/ 1
ZSITE8.6