Kendo Grid可选择不在弹出窗口中工作

时间:2014-02-17 23:52:07

标签: kendo-ui grid selectable

.cshtml文件的摘录:

<tr>
        <td colspan="3">
            <input class="k-button" value="Associate Service Location" onclick="assocLoc(this) " data-request-url="@Url.Action("AssociateLocation", "BillingAccount", new { customerId = Model.Id })"/>
        </td>
    </tr>

<!-- and later in the same file: -->

<div id="AssocLocWindow" class="container-border-rounded"></div>

相关的Javascript:     

function assocLoc(sender) {
    var win = $("#AssocLocWindow").kendoWindow({
        title: "Associate Service Location to BillingAccount",
        draggable: true,
        modal: true,
        content: $(sender).data("request-url"),
        actions: ["Close"]
    }).data("kendoWindow");
    win.center();
    win.open();
}

以下是相关的控制器代码:

public ActionResult AssociateLocation(int customerId)
    {
        var locations =
            new List<AM.Web.Models.ServiceLocation>
                {
                    new AM.Web.Models.ServiceLocation {Id = 1, AltId = "2", Description = "Bud's Roofing"},
                    new AM.Web.Models.ServiceLocation {Id = 3, AltId = "4", Description = "Sam's Plumbing"}
                };

        return this.PartialView("AssociateLocation", locations.AsEnumerable());
    }

这是来自AssociateLocation.cshtml的网格定义:

@model IEnumerable<AM.Web.Models.ServiceLocation>

@(Html.Kendo()
      .Grid(Model)
      .Name("sLocGrid")
      .Columns(columns =>
          {
              columns.Bound(results => results.Id);
              columns.Bound(results => results.AltId);
              columns.Bound(results => results.Description).Width(450);
          })
      .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
      .DataSource(datasource => datasource
                    .Ajax()
                    .Read(read => read.Action("AssociateLocation", "BillingAccount", new {customerId = 1}))
                    .Model(model => model.Id(p => p.Id))
      )
 )

问题是模态弹出窗口正确显示,控制器中的数据正确填充到网格中,但网格的行不可选。我尝试过单行选择和多行选择而没有运气。我也试过Editable()只是为了看看它是否有用,也没有运气。非常感谢任何想法。

0 个答案:

没有答案