Our state of the art Gantt chart


Post by eg1 »

Hi,
In the predecessor column when I open the picklist and press 'Enter' it adding the selected item in the list as predecessor.
I want to change this behavior and close the editor by Enter, there is a way to do this?
(currently the editor closes only by clicking outside)


Post by alex.l »

There is no such property to set that, but reachable with applying custom config:

    columns : [
        // ...
        {
            type  : 'predecessor',
            editor : {
                picker : {
                    navigator : {
                        processEvent   : e => {
                            if (e.key === 'Escape' || e.key === 'Enter') {
                                me.hidePicker();
                            }
                            else {
                                return e;
                            }
                        }
                    },
                }
            },
            width : 112
        },

All the best,
Alex


Post by eg1 »

thank you, but it's still not working..


Post by alex.l »

You're right, I missed the scope, sorry about that.

It's pretty tricky to do, since it is not supported. Try this instead?

        {
            type  : 'predecessor',
            editor : {
                listeners : {
                    paint({ firstPaint, source }) {
                        if (firstPaint) {
                            source.picker.navigator.processEvent = (e) => {
                                if (e.key === 'Escape' || e.key === 'Enter') {
                                    source.hidePicker();
                                }
                                else {
                                    return e;
                                }
                            }
                        }
                    }
                }
            },

All the best,
Alex


Post Reply