2010-04-22 14 views
10

Oto mój kodJak mieć 2 pagery w jqgridie jeden na górze i jeden na dole?

$(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 
    }); 
}); 

Odpowiedz

20

Uwzględnij "toppager: prawdziwy" do listy opcji jqGrid. Robi to dokładnie to, co chcesz: "Po włączeniu tej opcji umieść element pagera na górze siatki poniżej podpisu (jeśli jest dostępny) .Jeśli zdefiniowany jest inny pager, oba mogą współistnieć i są odświeżane zsynchronizowane."

Pełna lista opcji, które można znaleźć na http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options

+0

Dzięki Oleg, pomógł mi mnóstwo –

+1

@Allen: Nie ma za co! Jeśli chcesz bardziej dostosować pager, moja kolejna odpowiedź http://stackoverflow.com/questions/3552855/add-toolbar-in-the-bottom-of-the-header-using-jqgrid/3557663#3557663 może być również interesująca dla Ciebie. – Oleg

+0

@Oleg - czy to u góry lub w lewym górnym rogu? – leora

0

Jest 4 lata późno, ale widziałem coś takiego, opcję szablonu

template: '<div>' + 
      '<div class="jqgrid-pagination"></div>' + 
      '<table></table>' + 
      '<div class="jqgrid-pagination"></div>' +    
      '</div>', 
Powiązane problemy