Localization without call Columns.Command

3 posts, 0 answers
  1. JC Software Services, Inc.
    JC Software Services, Inc. avatar
    4 posts
    Member since:
    Jul 2015

    Posted 14 Aug 2015 Link to this post

    When use Grid edit command without calling GridActionColumnFactory.Edit(). GridBuilder would not render localization script for the popup edit. Just like the code.

    @(Html.Kendo().Grid<ProduceViewModel>()
        .Name("grid")
        .DataSource(datasource=>
            /*...*/
        )
        .Columns(columns =>
        {
            columns.Bound(m => m.ProductId).ClientTemplate("<a onclick='edit(this)'>#=ProductId#</a>");
            columns.Bound(m => m.ProductName);
            columns.Command(command =>
            {
                command.Destroy();
            });
        })
    )

  2. JC Software Services, Inc.
    JC Software Services, Inc. avatar
    4 posts
    Member since:
    Jul 2015

    Posted 14 Aug 2015 in reply to JC Software Services, Inc. Link to this post

    javascript code

    function edit(el) {
        var grid = $("#grid").data("kendoGrid");
        var row = $(el).closest("tr");
     
        grid.editRow(row);
    }

  3. Daniel
    Admin
    Daniel avatar
    2226 posts

    Posted 18 Aug 2015 Link to this post

    Hello,

    The update and cancel text options are part of the edit command configuration so if the command is not included, the localized messages will not be available. You can  include the edit command and hide the column:
    columns.Command(command =>
    {
        command.Edit();
    }).Hidden(true);

    or include the command to destroy command column and hide the button via CSS:
    columns.Command(command =>
    {
        command.Edit();
        command.Destroy();
    });
    #grid .k-grid-edit
    {
        display:none;
    }
    or include the kendo.messages file in order to localize the text.

    Regards,
    Daniel
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top