datatable数据表格 json数据如何拼接到rows[]里面 湿了多次都没成功(下面是demo ajax请求)
2016-09-27 15:24:34
  • 访问次数: 5
  • 注册日期: 2016-09-27
  • 最后登录: 2016-11-17
 $.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('服务器异常');
          }
      });
沙发
2016-09-28 14:25:21
  • 访问次数: 5
  • 注册日期: 2016-09-27
  • 最后登录: 2016-11-17
求大神指教   菜鸟一个
板凳
2016-10-27 15:53:18
赵展展
  • 访问次数: 8
  • 注册日期: 2016-10-24
  • 最后登录: 2016-12-17
菜鸟路过,我也想知道,还在学习中
#3
2016-10-28 16:57:53
sunhao
  • 访问次数: 277
  • 注册日期: 2015-04-20
  • 最后登录: 2023-12-13
ZUI 数据表格动态加载数据的例子: https://jsfiddle.net/catouse/9k9dgyqx/
#4
2017-03-10 09:12:14
sister
  • 访问次数: 2
  • 注册日期: 2017-03-10
  • 最后登录: 2017-03-10
zui的数据表格太难用了。难上手,开发成本高。 楼上这为兄弟 ,你获取到数据后可以,
                      $
                      (
                      'table.datatable'
                      ).
                      datatable
                      (
                      'load'
                      ,info);
#5
2017-12-04 18:39:06
张元
  • 访问次数: 2
  • 注册日期: 2017-12-04
  • 最后登录: 2017-12-04
兄弟 解决了吗  解决了发一下
1/1