如何在添加窗口中通过 html 助手更改弹出剑道网格的标题 [英] how to Change Caption of popup kendo grid by html helper in add window

查看:16
本文介绍了如何在添加窗口中通过 html 助手更改弹出剑道网格的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用弹出剑道网格,我使用添加新记录和编辑模式,我想在添加新记录时通过 html 助手更改弹出窗口剑道网格的标题.

 

@(Html.Kendo().Grid().Name("网格").Columns(columns =>{columns.Bound(p => p.PersonId).Title("Person Code").Width(100).Sortable(true);columns.Bound(p => p.Name).Title("Name").Width(200).Sortable(true);column.Bound(p => p.Family).Title("Family").Sortable(false);columns.Command(c => { c.Edit().Text("Edit").CancelText("Cancel").UpdateText("save"); c.Destroy().Text("Delete"); });}).Pageable().ToolBar(s => { s.Create().Text("ایجاد"); }).Editable(c => { c.TemplateName("Default").Mode(GridEditMode.PopUp); c.Window(x => x.Title("ویرایش")); }).Scrollable().Sortable().HtmlAttributes(new { style = "height:430px;" }).DataSource(dataSource => 数据源.Ajax().Model(c => c.Id(p => p.PersonId)).Create(c => c.Action("Read", "Home")).Read(read => read.Action("EditingPopup_Read", "Grid")).Update(update => update.Action("EditingPopup_Update", "Grid")).Destroy(update => update.Action("EditingPopup_Destroy", "Grid")).ServerOperation(真).PageSize(8).Read(read => read.Action("EditingPopup_read", "Home"))).Sortable().Filterable())

请告诉我如何在添加模式下更改弹出窗口的标题.

解决方案

我通过使用编辑事件修复了这个问题.

.Events(events => events.Edit("insertPopupCaption")<脚本>函数 insertPopupCaption(e) {如果(e.model.isNew()){$('.k-window-title').text("add");}}

I am using the popup kendo grid and i use add new record and edit mode and i want change caption of popup window kendo grid by html helper when i add new record.

    <div class="k-rtl">

    @(Html.Kendo().Grid<KendoSample.Models.Person>()
   .Name("grid")
   .Columns(columns =>
    {
        columns.Bound(p => p.PersonId).Title("Person Code").Width(100).Sortable(true);
        columns.Bound(p => p.Name).Title("Name").Width(200).Sortable(true);
        columns.Bound(p => p.Family).Title("Family").Sortable(false);
        columns.Command(c => { c.Edit().Text("Edit").CancelText("Cancel").UpdateText("save"); c.Destroy().Text("Delete"); });            
    })
.Pageable()

.ToolBar(s => { s.Create().Text("ایجاد"); })
.Editable(c => { c.TemplateName("Default").Mode(GridEditMode.PopUp); c.Window(x => x.Title("ویرایش")); })


.Scrollable()
.Sortable()
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
    .Ajax()
                            .Model(c => c.Id(p => p.PersonId))
                            .Create(c => c.Action("Read", "Home"))

    .Read(read => read.Action("EditingPopup_Read", "Grid"))
    .Update(update => update.Action("EditingPopup_Update", "Grid"))
    .Destroy(update => update.Action("EditingPopup_Destroy", "Grid"))                                


                            .ServerOperation(true)
    .PageSize(8)
    .Read(read => read.Action("EditingPopup_read", "Home"))
 )
 .Sortable()
 .Filterable()
 )

</div>

please tell me how to change caption of popup window in add mode.

解决方案

i fix this issue by use edit event.

.Events(events => events.Edit("insertPopupCaption")

<script>
 function insertPopupCaption(e) {
 if (e.model.isNew()) {
     $('.k-window-title').text("add");        
 }   
}
</script>

这篇关于如何在添加窗口中通过 html 助手更改弹出剑道网格的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆