Hi guys!
[client side] I've added a keypress-hook to the <delete> button and added a call to the "FileExplorer.deleteSelectedItems".
Problem is; when editing(renaming) folder in treeview and pressing <delete>-button this is interpreted as "deleteSelectedItems".
I've tried to use the item.get_isUpdating() method, but this always returns "false". How do I figure out if an element is
in "edit-mode"? Do you have any other solution(s) to how this may be solved?
BR
-Gard
[client side] I've added a keypress-hook to the <delete> button and added a call to the "FileExplorer.deleteSelectedItems".
Problem is; when editing(renaming) folder in treeview and pressing <delete>-button this is interpreted as "deleteSelectedItems".
I've tried to use the item.get_isUpdating() method, but this always returns "false". How do I figure out if an element is
in "edit-mode"? Do you have any other solution(s) to how this may be solved?
$(
function
() {
hookDeleteEvent();
});
var
keyCodeForDeleteButton = 46;
function
hookDeleteEvent() {
$(document).keyup(
function
(e) {
if
(e.keyCode == keyCodeForDeleteButton) {
runDeleteOnSelectedElement();
}
});
}
function
runDeleteOnSelectedElement() {
var
explorer = $find(
"<%=DocumentBrowser.ClientID %>"
);
if
(userMayDeleteSelectedFiles(explorer)) explorer.deleteSelectedItems();
}
function
userMayDeleteSelectedFiles(explorer) {
if
(isInEditMode(explorer))
return
false
;
return
true
;
}
function
isInEditMode(explorer) {
var
item = explorer.get_selectedItem();
return
item.get_isUpdating();
}
BR
-Gard