2010-04-22 69 views
10

這裏是我的代碼如何在jqgrid中有2個頁面頂部和底部?

$(document).ready(function() { 
    $('#jqgProducts').jqGrid({ 
     url: '/Home/GridSampleData/', // url from wich data should be requested 
     datatype: 'json',    // type of data 
     mtype: 'GET',     // url access method type 
     colNames: ['userid', 'username', 'email', 'contact', 'password'], 
     colModel: [     // columns model 
      { name: 'userId', index: 'userId', align: 'left', 
       editable: false }, 
      { name: 'username', index: 'username', align: 'left', 
       editable: true, edittype: 'text', 
       editoptions: { maxlength: 20 }, 
       editrules: { required: true} }, 
      { name: 'email', index: 'email', align: 'left', editable: true, 
       edittype: 'text', editoptions: { maxlength: 50 }, 
       editrules: { required: true} }, 
      { name: 'contact', index: 'contact', align: 'left', 
       editable: true, edittype: 'text', 
       editoptions: { maxlength: 20 }, editrules: { required: true} }, 
      { name: 'password', index: 'password', align: 'left', 
       editable: true, edittype: 'password', 
       editoptions: { maxlength: 20 }, 
       editrules: { required: true} } 
     ], 
     pager: $('#jqgpProducts'), // pager for grid 
     rowNum: 5,     // number of rows per page 
     sortname: 'userId',  // initial sorting column 
     sortorder: 'asc',   // initial sorting direction 
     viewrecords: true,   // we want to display total records count 
     width: '600',    // grid width 
     height: 'auto'    // grid height 
    }); 
}); 

回答

20

包括 「toppager:真正的」 給jqGrid的選項列表。這正是你想要的:「當啓用此選項時,在頁眉頂部的網格頂部放置尋呼機元素(如果可用)。如果定義了另一個尋呼機,它們可以共存並刷新同步。」

完整的參數列表,你可以在http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options

+0

感謝奧列格,幫我出一噸 – 2010-08-26 14:15:07

+1

@Allen:沒關係!如果你想更多的自定義尋呼機我的另一個答案http://stackoverflow.com/questions/3552855/add-toolbar-in-the-bottom-of-the-header-using-jqgrid/3557663#3557663也可能是有趣的爲你。 – Oleg 2010-08-26 14:21:04

+0

@Oleg - 這是否把它放在頂部中心或左上角? – leora 2011-09-01 20:03:51

0

找到這4年遲,但我看到了這樣的事情,模板選項

template: '<div>' + 
      '<div class="jqgrid-pagination"></div>' + 
      '<table></table>' + 
      '<div class="jqgrid-pagination"></div>' +    
      '</div>', 
相關問題