【问题标题】:How to have 2 pager in jqgrid one at top and one at bottom?如何在 jqgrid 中有 2 个寻呼机,一个在顶部,一个在底部?
【发布时间】:2011-02-11 00:48:10
【问题描述】:

这是我的代码

 $(document).ready(function () {
     $('#jqgProducts').jqGrid({
         url: '/Home/GridSampleData/', // url from which 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
     });
 });

【问题讨论】:

    标签: model-view-controller jqgrid pager


    【解决方案1】:

    在 jqGrid 选项列表中包含“toppager: true”。这正是您想要的:“启用此选项后,在标题下方的网格顶部放置一个寻呼机元素(如果可用)。如果定义了另一个寻呼机,则两者可以共存并同步刷新。”

    您可以在 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options 上找到完整的选项列表

    【讨论】:

    • 谢谢奥列格,帮了我很多忙
    • @Allen:欢迎您!如果您想对寻呼机进行更多自定义,我的另一个答案 stackoverflow.com/questions/3552855/… 可能对您来说也很有趣。
    • @Oleg - 是放在顶部中间还是左上角??
    • @ooo: "toppager: true" 创建与通常在底部看到的相同的寻呼机。
    • @Oleg。我使用了 toppager: true 和 cloneToTop: true,但是我的搜索、刷新和列重新排序/隐藏按钮没有转移到 toppager。只有分页按钮出现在顶部。我是否必须将这些按钮显式添加到首页页面?
    【解决方案2】:

    这晚了 4 年,但我看到了这样的东西,模板选项

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      相关资源
      最近更新 更多