小咪的农场 2017-11-16 07:39 采纳率: 0%
浏览 12770

bootstrap table 数据传递成功,就是不显示数据

bootstrap table 提示onloadsuccess 了,并且查看有数据,但是table就是不显示;
页面:




Alert
        <table id="fresh-table" class="table" data-pagination="true"
            data-show-toggle="true"
            data-showColumns="true">
            <thead>
                <tr>
                    <th data-field="id" data-checkbox="true">id</th>
                    <th data-field="username" data-sortable="true">Name</th>
                    <th data-field="phone" data-sortable="true">Salary</th>
                    <th data-field="actions" data-formatter="operateFormatter"
                        data-events="operateEvents">Actions</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>

</div>

JS:
 $(top.hangge());

    var $table = $('#fresh-table'),
        $alertBtn = $('#alertBtn'), 
        full_screen = false,
        window_height;

    $().ready(function(){

        window_height = $(window).height();
        table_height = window_height - 20;
        $table.bootstrapTable('destroy');

        $table.bootstrapTable({
        toolbar: ".toolbar",
        url : '<%=basePath%>receiving/queryList.do', //请求后台的URL(*)
        method : 'get', //请求方式(*)
        showRefresh : true,
        search : true,
        showToggle : true,
        showColumns : true,
        pagination : true,
        striped : true,
        sortable : true,
        height : table_height,
        pageSize : 25,
        pageList : [ 25, 50, 100 ],
        formatShowingRows : function(pageFrom, pageTo, totalRows) {
        },
        formatRecordsPerPage : function(pageNumber) {
            return pageNumber + " rows visible";
        },
        icons : {
            refresh : 'fa fa-refresh',
            toggle : 'fa fa-th-list',
            columns : 'fa fa-columns',
            detailOpen : 'fa fa-plus-circle',
            detailClose : 'fa fa-minus-circle'
        },
        onLoadSuccess : function(data) {
            alert(data.rows[0].username);//这边是有数据的
        },
        onLoadError : function(status) {
            alert(status);
        }
    });

    window.operateEvents = {
        'click .like' : function(e, value, row, index) {
            alert('You click like icon, row: ' + JSON.stringify(row));
            console.log(value, row, index);
        },
        'click .edit' : function(e, value, row, index) {
            alert('You click edit icon, row: ' + JSON.stringify(row));
            console.log(value, row, index);
        },
        'click .remove' : function(e, value, row, index) {
            $table.bootstrapTable('remove', {
                field : 'id',
                values : [ row.id ]
            });

        }
    };

    $alertBtn.click(function() {
        alert("You pressed on Alert");
    });

    $(window).resize(function() {
        $table.bootstrapTable('resetView');
    });
});

function operateFormatter(value, row, index) {
    return [
            '<a rel="tooltip" title="Like" class="table-action like" href="javascript:void(0)" title="Like">',
            '<i class="fa fa-heart"></i>',
            '</a>',
            '<a rel="tooltip" title="Edit" class="table-action edit" href="javascript:void(0)" title="Edit">',
            '<i class="fa fa-edit"></i>',
            '</a>',
            '<a rel="tooltip" title="Remove" class="table-action remove" href="javascript:void(0)" title="Remove">',
            '<i class="fa fa-remove"></i>', '</a>' ].join('');
}
  • 写回答

1条回答 默认 最新

  • IT论之程序员 2018-04-09 09:26
    关注

    F12打断点,进行一步步调试

    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办