JQGrid Setting different URLs for add,edit,delete

2019-04-10 08:13发布

I want to add three buttons on top of the grid for add,edit,delete. And want to make calls to separate URLs for each of the operation.I want to use Form Editing for this. Can anyone suggest me a sample code for this.

Thanks in advance, Abhishek

标签: jqgrid
1条回答
虎瘦雄心在
2楼-- · 2019-04-10 08:58

If you need to add form editing buttons on top of the grid you should use toppager:true option of jqGrid. You don't need to define any other pager div and don't need to use pager option. jqGrid creates a new div for the pager itself. The id of the pager div will be constructed from the id of the grid and the "_toppager" suffix. For example if you use

<table id="grid"></table>

then the div of the pager will have the id="grid_toppager" and you can use

$("#grid").jqGrid("navGrid", "#grid_toppager", {/*navGrid options*/},
    {url: "yourEditUrl"}, {url: "yourAddUrl"}, {url: "yourDelUrl"});

I recommend you to read this and this old answers for additional information.

查看更多
登录 后发表回答