0

我有一个带有工具栏的剑道网格,我如何将它放在网格之后。

我进行了快速搜索并在堆栈中找到了,但我的命令栏仍然显示在网格上方。

我不知道这里出了什么问题,谁能指出我正确的方向?代码:

 <div id="divDependentDetails" >
  @if (Model.IsDependentGridEnabled)
  {
@(Html.Kendo().Grid(Model.DependentDetailsList)
            .Name("DependentGrid")
            .Events(e => e.SaveChanges("DependentGridSave")

            )
                   .Columns(columns =>
                   {
                       columns.ForeignKey(p => p.TitleCode, Model.TitleList, "TitleCode", "TitleDescription").Title("Title");
                       columns.Bound(p => p.FirstName).Title("First Name");
                       columns.Bound(p => p.MiddleName).Title("Middle Name");
                       columns.Bound(p => p.LastName).Title("Last Name"); ;
                       columns.ForeignKey(p => p.Gender, Model.GenderList, "TitleCode", "TitleDescription").Title("Gender");
                       columns.ForeignKey(p => p.RelationShipCode, Model.RelationShipList, "RelationShipCode", "RelationShipName").Title("Relationship");
                       columns.Bound(p => p.DepDOB).Format("{0:dd-MMM-yyyy}").Title("Date of Birth");
                       columns.Bound(p => p.RelationShipStartDate).Format("{0:dd-MMM-yyyy}").Title("Relationship Start Date");
                       columns.Bound(p => p.RelationShipEndDate).Format("{0:dd-MMM-yyyy}").Title("Relationship End Date");
                       columns.Bound(p => p.EmailAddress).Title("Email");
                       columns.Bound(p => p.DepPassportNumber).Title("Passport Number");
                       columns.Bound(p => p.DepPassportExpDate).Format("{0:dd-MMM-yyyy}").Title("Passport Expiry");
                       columns.Command(command => command.Destroy());
                   })

                    .ToolBar(toolBar =>
                    {
                        toolBar.Create().Text("Add");
                        toolBar.Save().SaveText("Submit").CancelText("Reset");
                    })
                   .Editable(editable => editable.Mode(GridEditMode.InCell))

                   .Sortable()
                   .Resizable(resize => resize.Columns(true))
                   .Filterable()
                   .DataSource(dataSource => dataSource
                       .Ajax()
                        .Batch(true)
                       .ServerOperation(false)
                       .Model(model =>
                       {
                           model.Id(m => m.DependantDetialId);

                       })
                       .Update(update => update.Action("DependentDetails_Update", "EmployeeSelfService")
                 )
                 .Create(create => create.Action("DependentDetails_Create", "EmployeeSelfService")
         )
                 .Destroy(delete => delete.Action("DependentDetails_Destroy", "EmployeeSelfService")
             )
                 .Events(e => e.RequestEnd("DependentGrid_onComplete")
                 )
                   )
                   )

  }
</div>
<script>
    $("#DependentGrid").find(".k-grid-toolbar").insertAfter($("#DependentGrid .k-grid-content"));
</script>
4

1 回答 1

0

我明白了......在浏览了呈现的 HTML 之后,我发现其中没有“.k-grid-content”,只有“.k-grid”,而且效果很好......

<script>

// $("#DependentGrid").find(".k-grid-toolbar").insertAfter($("#DependentGrid .k-grid-content"));  --- not working

// Working Line 

$("#DependentGrid").find(".k-grid-toolbar").insertAfter($("#divDependentDetails .k-grid"));
</script>
于 2013-04-18T05:55:24.013 回答