我有一个kendo网格,其中我从一个表中绑定列。但是当我想从另一个表(JobItemModel
)添加一列时,该列中的数据为空。请帮忙。感谢
@(Html.Kendo().Grid<Modus.Presentation.Models.Jobs.JobModel>()
.Name("#jobs-grid")
.EnableCustomBinding(true)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(x => x.Id))
.Read(read => read.Action("List", "Jobs"))
)
.Columns(columns =>
{
columns.Bound(x => x.Id).Visible(false);
columns.Bound(x => x.JobItem).Visible(false);
columns.Bound(x => x.JobNumber);
columns.Bound(x => x.Customer.Id).ClientTemplate("#= Customer.Name #");
columns.Bound(x => x.JobItem.Name);
columns.Bound(x => x.JobItem.DateCompletition);
columns.Command(command => command.Custom("View Details").Click("showDetails"));
模特:
public class JobModel
{
//public virtual int Id { get; set; }
public JobModel()
{
JobItems = new List<JobItemModel>();
}
[ModusResourceDisplayName("gp.Job.Fields.JobNumber")]
public string JobNumber { get; set; }
[ModusResourceDisplayName("gp.Job.Fields.Customer")]
public int CustomerId { get; set; }
[ModusResourceDisplayName("gp.Job.Fields.Contact")]
[UIHint("CustomerContact")]
public int ContactId { get; set; }
public List<JobItemModel>JobItems { get; set; }
public CustomerModel Customer { get; set; }
public JobItemModel JobItem { get; set; }
}