我的 MVC 应用程序中有这个网格。我想在开头添加一列,允许用户选择行,然后在 POST 方法上我将获得所选行的信息。我还想在标题中添加一个主复选框,允许选择表格上的所有复选框(行)。
这就是我所拥有的:
@(Html.Grid("basic")
.SetRequestType(RequestType.Post)
.SetJsonReader(new MvcJqGrid.DataReaders.JsonReader { Id="ID", RepeatItems = false})
.SetCaption("Teams")
.AddColumn(new Column("<input type=checkbox editable=true>").SetFormatter(Formatters.Checkbox)
.SetEditable(true)
.SetWidth(32)
.SetFixedWidth(true)
.SetSortable(false)
.SetAlign(Align.Right))
.AddColumn(new Column("Identifier")
.SetLabel("Team Code")
.SetWidth(80))
.AddColumn(new Column("ClientName")
.SetWidth(135)
.SetLabel(Html.DisplayColumnNameFor(Model, m => m.Client.ClientName, typeof(Client)).ToHtmlString()))
.AddColumn(new Column("Name")
.SetWidth(135))
.AddColumn(new Column("IsActive")
.SetWidth(60)
.SetFixedWidth(true)
.SetLabel("Active")
.SetAlign(Align.Center)
.SetDefaultSearchValue("Active")
.SetSearchType(Searchtype.Select)
.SetSearchTerms(new string[] { "Active", "Deactivated", })
.SetFormatter(Formatters.Checkbox))
.SetUrl(Url.Action("Search", "CaseTeam"))
.SetAutoWidth(true)
.SetWidth(933)
.SetRowNum(20)
.SetRowList(new int[]{10,15,20,50})
.SetViewRecords(true)
.SetPager("pager")
.SetSearchToolbar(true).SetSearchOnEnter(false)
.SetSortName("Identifier") )
我看到的是我想要的所有复选框,但是:
- 可以单击标题复选框,但不会选中它。
- 其余复选框无法单击。(我有可编辑为真)
我不知道发生了什么,有什么想法吗?