0
저는 Razor와 KendoUI로 ASP.NET MVC 4.5 프로젝트를 만들고 있습니다. | Rol.Name와KendoUI Grid. 열의 다중 값
열 : 나는 다음과 같은 두 개의 클래스가 있습니다
public class Rol
{
[Key]
[ScaffoldColumn(false)]
public int RolId { get; set; }
[Required]
[MaxLength(50)]
public string Name{ get; set; }
[MaxLength(255)]
public string Desciption { get; set; }
public bool Active{ get; set; }
[DisplayName("Permissions")]
public virtual ICollection<Permission> Permissions { get; set; }
}
public class Permission
{
[Key]
[ScaffoldColumn(false)]
public int PermisoId { get; set; }
[Required]
[MaxLength(50)]
public string Name { get; set; }
[MaxLength(255)]
public string Description { get; set; }
public bool Active { get; set; }
public ICollection<Rol> Rols { get; set; }
}
을하지만 열이 그리드를 만드는 방법을 알고하지 않습니다 Rol.Description | Rol.Active | 모든 Rol.Permissions.Name (목록)와 열
그리고보기에서
을 KendoUI
의 CRUD 작업을 spport 내가 가진 :@model IEnumerable<ItemsMVC.Models.Rol>
@(
Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(c =>
{
c.Bound(p => p.RolId).Visible(false);
c.Bound(p => p.Name);
c.Bound(p => p.Description);
c.Bound(p => p.Active)
.ClientTemplate("#= Active ? 'yes' : 'No' #")
.Width(100);
**HERE THE LIST OF PERMISSIONS**
c.Command(p => {
p.Edit();
p.Destroy();
}).Width(200);
}
)
.Pageable(p => p.Enabled(true))
.Scrollable(s => s.Enabled(true))
.Sortable(s => s.Enabled(true))
.Filterable(f => f.Enabled(true))
.ColumnMenu(c => c.Enabled(true))
.ToolBar(t => t.Create())
.Editable(e => e.Mode(GridEditMode.PopUp))
.DataSource(ds => ds
.Ajax()
.Model(model =>model.Id(p => p.RolId))
.Create(c => c.Action("EditingInline_Create", "Rol"))
.Read(r => r.Action("Permisos_Read","Rol"))
.Update(u => u.Action("EditingInline_Update", "Rol"))
.Destroy(d => d.Action("EditingInline_Destroy", "Rol"))
)
)
열에 여러 필드를 구성하는 데 ClientTemplate을 사용합니다. – OnaBai