小咪的农场 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 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)