博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

返回CELL=[]的时候,提示

Posted on 2012-09-03 13:55  oilsun  阅读(139)  评论(0编辑  收藏  举报

//返回CELL=[]的时候,提示

 

 <script type="text/javascript">
    //<![CDATA[
        $(document).ready(function () {
            var grid = $('#oversight-sample');
            var pages = []; // not as {};
            var emptyMsgDiv = $('<div>No URLs have been loaded for evaluation.</div>');
            grid.jqGrid({
                altRows: true,
                autowidth: true,
                caption: 'Evaluated URLs',
                colNames: ['Actions', 'URL', 'Fetch Date'],
                colModel: [
                { align: 'center', name: 'actions', index: 'actions', title: false, width: 60, resizable: false, sortable: false },
                { name: 'url', index: 'url', width: 400 },
                { align: 'center', name: 'created', index: 'created', width: 125, sorttype: 'date' }
              ],
                data: pages,
                datatype: 'local',
                emptyrecords: 'No URLs have been loaded for evaluation.',
                beforeRequest: function () {
                    if (pages.length === 0) {
                        grid[0].p.page = 0; // fix the page number from 1 to 0 in case of no data
                    }
                },
                loadComplete: function () {
                    var count = grid.getGridParam();
                    var ts = grid[0];
                    if (ts.p.reccount === 0) {
                        grid.hide();
                        emptyMsgDiv.show();
                    } else {
                        grid.show();
                        emptyMsgDiv.hide();
                    }
                },
                forceFit: true,
                //height: 'auto',
                hoverrows: true,
                sortname: 'created',
                pager: '#url-pager',
                viewrecords: true
            });
            // place div with empty message insde of bdiv
            emptyMsgDiv.insertAfter(grid.parent());
        });
    //]]>
    </script>