Completed
Last Updated: 07 Jan 2025 08:35 by ADMIN
Release 2025 Q1 (Feb)
Alexey
Created on: 23 Dec 2024 08:52
Category: Grid
Type: Bug Report
1
SaveButton() method does not render Cancel Command in Grid's Toolbar Template

Bug Report

The SaveButton() method does not render the Cancel Command button in Grid's Toolbar Template

Reproduction of the issue

  1. Declare the Grid's Toolbar.Template() API configuration with an Action or Delegate
  2. Notice, that Grid's Toolbar does not explicitly add the Cancel Command button.
@(Html.Kendo().Grid<GridModel>()
    ...
   .Name("grid")
   .ToolBar(t =>
      {
          t.Template(@<text>
            <span class="group-buttons">
	         @item.SaveButton();
            </span>
          </text>);
  })
)

Current behaviour

The SaveButton() method does not render the Cancel Command in Grid's Toolbar Template.

Expected behavior

The SaveButton() method should render the Cancel Command in Grid's Toolbar Template.

Workaround

A possible way to circumvent this behavior would be to explicitly declare both the Save and Cancel buttons as independent Button components via the Toolbar.ClientTemplate() API configuration.

@(Html.Kendo().Grid<GridModel>()
	...
	.Name("grid")
        .ToolBar(t =>
	{
		t.ClientTemplate(Html.Kendo().Template()
				.AddHtml(@<text>
					<span class="group-buttons">
				</text>)
				.AddComponent(saveBtn => saveBtn
					.Button()
					.Name("saveBtn")
					.Icon("check")
					.HtmlAttributes(new { @class = "k-grid-save-changes", style="margin-right: 2%;" })
					.Content("Save Changes")
				)
				.AddComponent(cancelBtn => cancelBtn
					.Button()
					.Icon("cancel")
					.Name("cancelBtn")
					.HtmlAttributes(new { @class = "k-grid-cancel-changes" })
					.Content("Cancel Changes")
				)
				.AddHtml("</span>")
		);
	})
)
0 comments