Edit this page

Delete Disabled Cell Content with ContextMenu in Spreadsheet

Environment

Product Progress Kendo UI Spreadsheet
Operating System Windows 8.1
Browser All
Visual Studio version Visual Studio 2015

Description

I use the Kendo UI ContextMenu to delete rows from the Spreadsheet.

How can I delete a disabled cell in a Spreadsheet row through the Delete command from the ContextMenu?

Solution

  1. Bind the select event to the ContextMenu of the Spreadsheet.
  2. Determine whether the currently selected command is Delete.
  3. Enable the current selection (which is the entire row) and clear it.
<div id="spreadsheet"></div>
<script>
    $(function() {
        var spreadsheet = $("#spreadsheet").kendoSpreadsheet({
                sheets: [{
                    rows: [{
                        cells: [{
                            value: "My Company",
                            enable: false
                        }]
                    }],

                }]
            }).data("kendoSpreadsheet"),
            rowContextMenu = spreadsheet.rowHeaderContextMenu();

        rowContextMenu.bind("select", function(e) {

            var command = $(e.item).text();

            if (command == "Delete") {
                var sheet = spreadsheet.activeSheet(),
                    selection = sheet.selection();

                selection.enable(true)
                selection.value([])
            }
        });
    });
</script>

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy