2014-06-06 45 views
0

我在我的MVC應用程序中有這個網格。 我想在開始處添加一列,它允許用戶選擇行,然後在POST方法中,我將獲得所選行的信息。 另外我想在標題中添加一個主複選框,允許選擇表格上的所有複選框(行)。JqGrid MVC剃刀複選框列選擇行

這是我有:

@(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")) 

我看到所有我想要的複選框,而是:

  • 頭複選框可以點擊,但它不會進行檢查。
  • 複選框的其餘部分無法點擊。 (我可以編輯爲true)

我不知道最近發生了什麼,有什麼想法嗎?

回答

0

解決它添加

.SetMultiSelect(true) 

我的錯誤是嘗試添加該列,當存在確實已經一個屬性。