How to add the "delete" hotkey to Account Address detail?

In order to delete an address on Account page, I need to click Actions first, then press the Delete button.

 

I would like to use a hotkey for this. How could I do it? I've seen this question, but don't know how to adapt it to my needs. Should I modify the code of AccountPageV2 for this? How to get the selected address row?

Or maybe this improvement is already planned in Creatio's next releases?

Like 0

Like

1 comments
Best reply

Hello Yuriy, 



In order to implement the requested functionality please create a replacing module for "AccountAddressDetailV2" and override "onGridDataLoaded" method in it ( It's being called after rendering). 

In this method you can retrieve a detail's grid and get the DOM element from it. You can assign your own handler on it's keydown event whcih will call  "this.deleteRecords()" after pressing the needed button. 



Here is the example for the "Delete" button in "AccountAddressDetailV2":



define("AccountAddressDetailV2", [], function() {

    return {

        entitySchemaName: "AccountAddress",

        diff: /**SCHEMA_DIFF*/ [] /**SCHEMA_DIFF*/,

        methods: {

            onGridDataLoaded: function() {

                this.callParent(arguments);

                var grid = this.getCurrentGrid();

                var wrapEl = grid.getWrapEl();

                wrapEl.on("keydown", this.onKeyDown, this);

            },

            onKeyDown: function(event) {

                if (event.keyCode === event.DELETE) {

                    this.deleteRecords();

                }

            }

        }

    };

});



Kind regards,

Roman 

Hello Yuriy, 



In order to implement the requested functionality please create a replacing module for "AccountAddressDetailV2" and override "onGridDataLoaded" method in it ( It's being called after rendering). 

In this method you can retrieve a detail's grid and get the DOM element from it. You can assign your own handler on it's keydown event whcih will call  "this.deleteRecords()" after pressing the needed button. 



Here is the example for the "Delete" button in "AccountAddressDetailV2":



define("AccountAddressDetailV2", [], function() {

    return {

        entitySchemaName: "AccountAddress",

        diff: /**SCHEMA_DIFF*/ [] /**SCHEMA_DIFF*/,

        methods: {

            onGridDataLoaded: function() {

                this.callParent(arguments);

                var grid = this.getCurrentGrid();

                var wrapEl = grid.getWrapEl();

                wrapEl.on("keydown", this.onKeyDown, this);

            },

            onKeyDown: function(event) {

                if (event.keyCode === event.DELETE) {

                    this.deleteRecords();

                }

            }

        }

    };

});



Kind regards,

Roman 

Show all comments