{extend name="common/common2" /}
{block name="main"}
<div class="ibox">
    <div class="ibox-content">
    </div>
    <div class="ibox-content">
        <div class="jqGrid_wrapper">
            <table id="table" style="border-collapse: collapse"></table>
            <div id="pager"></div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    $(function () {

        $(window).bind("resize",function(){
            var width=$(".jqGrid_wrapper").width();
            $("#table").setGridWidth(width);
        });

        $.jgrid.defaults.styleUI="Bootstrap";
        $("#table").jqGrid({
            url:"{:url('index')}",
            datatype: "json",
            colModel:[
                {label:'数值',name:'num',index:'num',width:80,editable: false,sortable: false},
                {label:'时间',name:'add_time',index:'add_time',width:80,editable: false,sortable: false},
            ],
            rowNum:10,
            rowList:[10,20,30,50,100],
            pager: '#pager',
            sortname: 'id',
            viewrecords: true,
            autowidth:true,
            mtype: 'post',
            height: 'auto',
            emptyrecords: "暂无数据",
            sortorder: "desc",
            caption:"{$meta_title}",
            loadComplete: function (xhr) {
                if(xhr.code==0){
                    layer.msg(xhr.msg);
                    return false;
                }
            },
        });
    });

</script>
{/block}