如何在Kendo-PivotGrid-MVC的DataCellTemplate()中获取模型值

时间:2015-02-09 12:02:16

标签: kendo-ui kendo-grid kendo-asp.net-mvc

@(Html.Kendo().PivotGrid<Models.MyModel>()
.Name("pivotgrid")
.DataSource(dataSource => dataSource.Ajax()
  .Transport(transport => transport.Read("ActionMethod", "Controller"))
  .Schema(schema => schema.Cube(cube => cube.Dimensions(dimensions =>
  {
      dimensions.Add(model => model.FirstName).Caption("Learner");
      dimensions.Add(model => model.CompetencyCode).Caption("Competency Codes");
      dimensions.Add(model => model.OutComeRTOCode).Caption("OutCome RTO");
      dimensions.Add(model => model.StudentId);
      dimensions.Add(model => model.GroupId);
      dimensions.Add(model => model.CompetencyId);
  })

      .Measures(measures => measures.Add("OutComeRTOCode Count").Field(model => model.OutComeRTOCode).AggregateName("Count").Field(a => a.StudentId).Field(a => a.GroupId).Field(a => a.EnrolmentId).ToString())

      ))
      .Columns(columns => { columns.Add("CompetencyCode").Expand(true); })
      .Rows(rows => rows.Add("FirstName").Expand(true))
                .Rows(rows => rows.Add("StudentId"))
                .Rows(rows => rows.Add("GroupId"))
                .Rows(rows => rows.Add("CompetencyId"))
      .Measures(measures => measures.Values("OutComeRTOCode Count")))
     .DataCellTemplate("<a onclick='GroupEnrolment(StudentId)'>#:kendo.toString(dataItem.value)#</a>")
)

在代码中,我试图在DataCellTemplate中获取StudentId(&#39;&lt;&#39; a onclick =&#39; GroupEnrolment 想要通过StudentId作为参数 &#39;&gt;&#39;#:kendo.toString(dataItem.value)#&#39;&lt;&#39; / a&# 39;&GT;&#39;)

尝试将 GroupEnrollment(StudentId)中的StudentId作为参数传递,我不知道如何从Model获取StudentId并将其传递给锚标记中的function-GroupEnrollment。 或者是否有任何其他方法可以在Kendo Pivot Grid的单元格中创建链接。 任何帮助将不胜感激。 在此先感谢。

0 个答案:

没有答案