4

i have added pager:"#pager" but now i don't think that i need paging so i just need a add button(+), son can anybody tell me how to set paging false without removing the whole bar..just remove pagging

 grid.jqGrid('navGrid', '#pager',
        { resize: false, add: false, search: false, del: false, refresh: false, edit: false, alerttext: 'Please select one user' }

    ).jqGrid('navButtonAdd', '#pager',
        { title: "Add New users", buttonicon: "ui-icon ui-icon-plus", onClickButton: showNewUsersModal, position: "First", caption: "" });
R K Sharma
  • 845
  • 8
  • 23
  • 42
  • it may be a stupid question ;( – R K Sharma Dec 10 '13 at 14:43
  • Read this : http://www.trirand.com/jqgridwiki/doku.php?id=wiki:pager#properties ;) There is no stupid question. You have to set pgbuttons, pginput to false to do what you want. – kmas Dec 10 '13 at 14:45
  • i read it but i don't want to remove the bar just want to remove the paging so the (+) add button still appears.. i need that button there – R K Sharma Dec 10 '13 at 14:49
  • It doesn't remove the bar. It just removes some inputs. If you can create a JsFiddle of what of you have done, it will be easier to help you. – kmas Dec 10 '13 at 14:50
  • yes but things like <(Page of 1)> are still there i just want to remove those things – R K Sharma Dec 10 '13 at 14:54
  • 1
    Add `viewrecords : false, pgtext : ""` in your jqGrid options. It should be enough – kmas Dec 10 '13 at 14:56

2 Answers2

7

Read this : pager properties.

You have to set pgbuttons, pginput to false to do what you want.

grid = $("#your_table").jqGrid({
   // all your options
   pgbuttons : false,
   viewrecords : false,
   pgtext : "",
   pginput : false
});
grid.jqGrid('navGrid', '#pager',
    { resize: false, add: false, search: false, del: false, refresh: false, edit: false,    alerttext: 'Please select one user' }

).jqGrid('navButtonAdd', '#pager',
    { title: "Add New users", buttonicon: "ui-icon ui-icon-plus", onClickButton: showNewUsersModal, position: "First", caption: "" });
kmas
  • 6,401
  • 13
  • 40
  • 62
  • This just hides the buttons, but pagination still exist. – jstuardo Nov 04 '16 at 21:29
  • @jstuardo, look at what wanted R K Sharma. ;) For what you need, maybe look at this : http://stackoverflow.com/a/6782965/1788704. – kmas Nov 07 '16 at 09:10
2

I was able to accomplish this without having to use the navButtonAdd method. Simply set the pgbuttons, pginput properties to false and pgtext to "". Configure the navGrid properties as you would otherwise.

Testing used free-jqgrid. https://github.com/free-jqgrid

$('#grid_id').jqGrid({
    url:'url',
    editurl:'edit_url',
    height: 'auto',
    shrinkToFit: true,
    width: 280,
    datatype: 'xml',
    mtype: 'POST',
    postData:{
        ...
    },
    colNames:[
        ...
    ],
    colModel:[
        ...
    ],
    sortname: 'idsort',
    sortorder: 'asc',
    viewrecords: true,
    gridview: true,
    caption: 'Caption',
    pager: true,
    rowNum: 10000,
    pgbuttons: false,
    pginput: false,
    pgtext: ""
});
$('#grid_id').jqGrid("navGrid", 
    { 
        position:"center", 
        iconsOverText: true, 
        addtext: "Add", 
        edit: false, 
        deltext: "Delete", 
        search: false, 
        refreshtext: "Reload", 
        view: false 
    }
);
jeffery_the_wind
  • 17,048
  • 34
  • 98
  • 160