We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Prevent delete button from removing nodes in treeview

I'm trying to keep all keyboard functionality other than removing nodes with the delete key. Is there a way of doing this?

3 Replies

SN Sasikala Nagarajan Syncfusion Team May 11, 2015 12:38 PM UTC

Hi Robert,

Thanks for using Syncfusion products,

We have analyzed your requirement (keep all keyboard functionality other than removing nodes with the delete key) and we would like let you know that there is no inbuilt option to achieve this requirement. But we can achieve this by overriding the treeivew’s key press function to cancel the key press event if delete key is pressed.

Please refer the below code snippet

var click = ej.TreeView.prototype._KeyPress;

ej.TreeView.prototype._KeyPress = function (e) {

// {handle the custom event or method here}

if (e.keyCode == 46) return false;

else click.call(this, e);
}



For your convenience we have prepared the simple sample based on this it can be downloaded from below location.

Sample

Please check with the given sample and let us know if you have further queries.

Regards,

Sasikala Nagarajan



RD Robert David May 11, 2015 02:35 PM UTC

Thank you.


SN Sasikala Nagarajan Syncfusion Team May 12, 2015 09:25 AM UTC

Hi Robert,
Please let us know if you have further queries.We will be happy to help you out.
Regards,
Sasikala Nagarajan

Loader.
Live Chat Icon For mobile
Up arrow icon