我有一个包含子网格的网格。两个网格都有一个复选框列。当我单击父复选框时,它会自动选中/取消选中所有子网格复选框。所有复选框都映射到 DB 值,因此每次状态更改时,它都会更改 DB 中的值,然后我重新加载网格以更新复选框状态。
问题是,当我重新加载网格时,我松开了扩展的子网格,这很烦人,因为每次单击复选框时它都会重新加载网格...
有没有办法在重新加载网格时保持哪一行被消耗的状态?
这是我的代码的一部分:
$('#jqgSearchTaxPayer').jqGrid({
....
subGrid: true,
subGridRowExpanded: function (sendSubGrid, lineId) {
var sendSubGridId;
sendSubGridId = sendSubGrid + "_t";
$("#" + sendSubGrid).html("<table id='" + sendSubGridId + "' class='scroll'></table>");
$("#" + sendSubGridId).jqGrid({
....
{ name: 'Keep', index: 'Keep', width: '9px', align: 'center',
editable: true, edittype: 'checkbox',
formatter: function (cellvalue, options, rowObject) {
cellvalue = cellvalue + "";
cellvalue = cellvalue.toLowerCase();
var bchk = " checked=\"checked\"";
if (cellvalue == "false") {
bchk = "";
}
return "<input …Run Code Online (Sandbox Code Playgroud) 我尝试将Jquery中的表单提交给Controller中的Action方法.为此,我序列化我的表单并使用get方法.在控制器中,我接收我的表单作为字符串,如param1 = 1¶m2 = 2 ....有没有办法直接检索我的Action方法中的FormCollection而不是字符串.由于我的表单有很多复选框,因此我更容易在formCollection中使用它.
这是我的Jquery:
var form = $("#CheckForm");
var formCollection = form.serialize();
$.post('@Url.Action("CheckSelection")', { clientId: clientId, policyId: policyId, countryCode: country, month: monthtoken[0] + '*' + monthtoken[1], formCollection: formCollection }, function () {
alert("formSubmit");
});
Run Code Online (Sandbox Code Playgroud)
我的形式在这里:
@using (Html.BeginForm("CheckSelection", "Check", FormMethod.Post, new { id = "CheckForm" }))
{
<fieldset>
<div class="editor-label">
@Html.CheckBox("CodeExist",true)
@Html.Label("Check Code Existence")
</div>
<div class="editor-label">
@Html.CheckBox("Mandatory",true)
@Html.Label("Check Code Reccurence")
</div>
<div class="editor-label">
@Html.CheckBox("Reccurence",true)
@Html.Label("Check Mandatory Code")
</div>
}
Run Code Online (Sandbox Code Playgroud)
这是我的行动方法:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult CheckSelection(string clientId, string policyId, …Run Code Online (Sandbox Code Playgroud)