jquery网格按钮没有显示

时间:2013-08-31 15:31:02

标签: javascript ajax jquery jqgrid

我的jqGrid上的按钮不会显示(后退,前进,首页,最后一页,搜索等)。

图像:

代码:

<h3><?php echo $title?></h3>
<?php $lastbids = SchedulesData::GetLatestBids(); print_r($lastbids);?>
<link rel="stylesheet" type="text/css" media="screen" href="website/lib/js/jqgrid/css/ui.jqgrid.css" />
<script src="website/lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="website/lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>

<table id="grid"></table>
<div id="pager"></div>
<br />

<script type="text/javascript">
$("#grid").jqGrid({
   url: 'website/schedules/schedulegrid',
   datatype: 'json',
   mtype: 'GET',
   colNames: ['Code', 'Flight Num', 'Departure', 'Arrival', 'Aircraft', 'Distance', 'Route',
                'Bid'],
   colModel : [
        {index: 'code', name : 'code', width: 40, sortable : true, align: 'center', search: 'true', searchoptions:{sopt:['eq','ne']}},
        {index: 'flightnum', name : 'flightnum', width: 65, sortable : true, align: 'center', searchoptions:{sopt:['eq','ne']}},
        {index: 'depicao', name : 'depicao', width: 60, sortable : true, align: 'center',searchoptions:{sopt:['eq','ne']}},
        {index: 'arricao', name : 'arricao', width: 60, sortable : true, align: 'center',searchoptions:{sopt:['eq','ne']}},
        {index: 'a.name', name : 'aircraft', width: 100, sortable : true, align: 'center',searchoptions:{sopt:['in']}},
        {index: 'distance', name : 'distance', width: 100, sortable : true, align: 'center', searchoptions:{sopt:['lt','le','gt','ge']}},
        {index: 'route', name : 'route', width: 100, sortable : true, align: 'center',searchoptions:{sopt:['in']}},
        {index: '', name : '', width: 100, sortable : true, align: 'center', search: false}
    ],
    pager: '#pager', rowNum: 25,
    sortname: 'flightnum', sortorder: 'asc',
    viewrecords: true, autowidth: true,
    height: '100%'

});

jQuery("#grid").jqGrid('navGrid','#pager', 
    {edit:false,add:false,del:false,search:true,refresh:true},
    {}, // edit 
    {}, // add 
    {}, //del 
    {multipleSearch:true} // search options 
); 

function showroute(schedule_id)
{
    $('#jqmdialog').jqm({
        ajax:'website/schedules/viewmap?type=schedule&id='+schedule_id
    }).jqmShow();
}

function addbid(id)
{
    $.post("http://website/schedules/addbid", { id: id },
            function() 
            { 
                $("#grid").trigger("reloadGrid"); 
            }
        );
}

function removebid(id)
{
        $.post("http://website/schedules/removebid", { id: id },
            function() 
            { 
                $("#grid").trigger("reloadGrid"); 
            }
        );

}
</script>

我查看了堆栈溢出的其他一些帖子,但它们似乎都不适合我。如何让按钮出现?

1 个答案:

答案 0 :(得分:1)

你必须包含一些jQuery UI CSS文件。例如:

<link rel="stylesheet" type="text/css"
      href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" />

请参阅the documentation中的示例。