jqGrid add、edit 怎么用
<script>
$(document).ready(function () {
$.jgrid.defaults.styleUI = "Bootstrap";
$("#table_list_2").jqGrid({
//data: mydata,
datatype: "json",//设置使用json数据
url: "@Url.Action("Json", "Account")", //这是Action的请求地址
height: 450,
autowidth: true,
shrinkToFit: true,
//初始加载条数
rowNum: 5,
//可以控制每页显示多少
rowList: [5, 10, 15],
//设置每列的名称
colNames: ["编 号", "名 称","点击率","上映时间","类 型"],
//这是设置每列的属性
colModel: [{ name: "PlayId", index: "PlayId", editable: true, width: 60, sorttype: "int", search: true, align: "center" },
{ name: "PlayName", index: "PlayName", editable: true, width: 90, sorttype: "string", align: "center" },
{ name: "PlayClick", index: "PlayClick", editable: true, width: 100, sorttype: "int", align: "center" },
{ name: "PlayUpTime", index: "PlayUpTime", editable: true, width: 80, sorttype: "string", align: "center" },
{ name: "PlayTypeName", index: "PlayTypeName", editable: true, width: 80, sorttype: "string", align: "center" }
],
//分页工具栏
pager: "#pager_list_2", viewrecords: true, caption: "电影展示", add: true, edit: true, addtext: "Add", edittext: "Edit", hidegrid: false
});
$("#table_list_2").setSelection(4, true);
$("#table_list_2").jqGrid("navGrid", "#pager_list_2", { edit: true, add: true, del: true, search: true }, { height: 200, reloadAfterSubmit: true });//增加功能栏
$(window).bind("resize", function () { var width = $(".jqGrid_wrapper").width(); $("#table_list_2").setGridWidth(width) })
});
</script>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="ibox-content">
<h4 class="m-t"></h4>
<div class="jqGrid_wrapper">
<table id="table_list_2"></table>
<div id="pager_list_2"></div>
</div>
</div>
</div>
</div>
</div>
手动写的分页,带有添加和编辑的按钮

因为这个插件我是从网上找的,对于这个控件不了解,虽然添加了按钮,但是不知道怎么设置,求大神指导下,怎么设置add和edit这2个按钮跳转的地址和属性,最好带例题,万分感谢
$(document).ready(function () {
$.jgrid.defaults.styleUI = "Bootstrap";
$("#table_list_2").jqGrid({
//data: mydata,
datatype: "json",//设置使用json数据
url: "@Url.Action("Json", "Account")", //这是Action的请求地址
height: 450,
autowidth: true,
shrinkToFit: true,
//初始加载条数
rowNum: 5,
//可以控制每页显示多少
rowList: [5, 10, 15],
//设置每列的名称
colNames: ["编 号", "名 称","点击率","上映时间","类 型"],
//这是设置每列的属性
colModel: [{ name: "PlayId", index: "PlayId", editable: true, width: 60, sorttype: "int", search: true, align: "center" },
{ name: "PlayName", index: "PlayName", editable: true, width: 90, sorttype: "string", align: "center" },
{ name: "PlayClick", index: "PlayClick", editable: true, width: 100, sorttype: "int", align: "center" },
{ name: "PlayUpTime", index: "PlayUpTime", editable: true, width: 80, sorttype: "string", align: "center" },
{ name: "PlayTypeName", index: "PlayTypeName", editable: true, width: 80, sorttype: "string", align: "center" }
],
//分页工具栏
pager: "#pager_list_2", viewrecords: true, caption: "电影展示", add: true, edit: true, addtext: "Add", edittext: "Edit", hidegrid: false
});
$("#table_list_2").setSelection(4, true);
$("#table_list_2").jqGrid("navGrid", "#pager_list_2", { edit: true, add: true, del: true, search: true }, { height: 200, reloadAfterSubmit: true });//增加功能栏
$(window).bind("resize", function () { var width = $(".jqGrid_wrapper").width(); $("#table_list_2").setGridWidth(width) })
});
</script>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="ibox-content">
<h4 class="m-t"></h4>
<div class="jqGrid_wrapper">
<table id="table_list_2"></table>
<div id="pager_list_2"></div>
</div>
</div>
</div>
</div>
</div>
手动写的分页,带有添加和编辑的按钮

因为这个插件我是从网上找的,对于这个控件不了解,虽然添加了按钮,但是不知道怎么设置,求大神指导下,怎么设置add和edit这2个按钮跳转的地址和属性,最好带例题,万分感谢
...全文


