Skip to content

Default Paste Mode #8050

@kendo-bot

Description

@kendo-bot

By default, when the "paste" command is added, the default option is "insert" mode ("Paste (Insert)"). Is it possible to add an option that allows setting the default paste mode to "replace" ("Paste (Replace)")?

For example:

$("#grid").kendoGrid({
       toolbar: ["paste"],
       allowPaste: {
         default: "replace"
       },
       ...
});

Workaround

  • Handle the "dataBound" event of the Grid and get a reference to the Toolbar DropDownList.
  • Use the data() method of the DropDownList's DataSource to set only the "replace" option.
  • Call the value() method to update the default pasting option.
<script>
function onDataBound() {
    var ddl = $(".k-grid-paste-action[data-role='dropdownlist']").getKendoDropDownList();
    ddl.dataSource.data([{text: "Paste (Replace)", value: "replace"}]);
    ddl.value("replace");
}
</script>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions