How to trigger the drop event by pressing enter in Extjs

Asked

Viewed 82 times

0

I wonder if there’s any way I can trigger a drop event by pressing enter on a treepanel. I’m not able to fire the event manually, which I’ve achieved so far:

mediaCenter.getEl().addKeyMap({
    eventName: "keyup",
    binding: [{
        key: Ext.EventObject.ENTER,
        fn: function() {
            var node = mediaCenter.view.getSelectionModel().getSelection();
            node = node[0];
            var model = mediaCenter.view.getSelectionModel();
            var args = new Object({
                                    node: node,
                                    dropPosition: 1
                                });
            grid.fireEvent('beforeDrop', args);
            console.log(node);
        }
    }]
}));

I want that when the user presses enter, the node that is selected goes to the grid that I created.

Thank you.

1 answer

1

Good morning.

If you want to press enter to happen the event I think would not be implemented in drag and drop.

Have you tried this logic in the event itemkeydown of Treepanel so you identify the key enter and removes the Node of Tree and adds the values in Grid
I hope I’ve helped

Browser other questions tagged

You are not signed in. Login or sign up in order to post.