Our blazing fast Grid component built with pure JavaScript


Post by scebotari66 »

Hello, team!

The issue is related to this feature request. Here is the working sample Animal has provided:

new Panel({
    appendTo   : document.body,
    title      : 'Panel Title',
    height     : 400,
    layout     : 'fit',
    namedItems : {
        magicButton : {
            text : 'Magic Button'
        }
    },
    items : {
        grid : {
            type     : 'grid',
            columns  : [{ field : 'name', text : 'Name' }],
            features : {
                cellMenu : {
                    menu : {
                        namedItems : 'up.namedItems',
                        items      : {
                            magicButton : true
                        }
                    }
                }
            },
            data : [
                { id : 1, name : 'First' },
                { id : 2, name : 'Second' },
                { id : 3, name : 'Third' }
            ]
        }
    }
});

In that example, we would want to hide "removeRow" and copy/paste related items (so that only the "magicButton" item is visible).

We have tried this:

//...
features: {
    rowCopyPaste: false,
    cellMenu: {
        items: {
            removeRow: false,
        },
        menu: {
            namedItems: 'up.namedItems',
            items: {
                magicButton: true,
            },
        },
    },
},
//...

But with the "features" configuration above no menu is shown. With only "rowCopyPaste: false," or "removeRow: false," it works as expected, but with both - it does not. Any idea what might be wrong?

Also, shouldn't specifying "removeRow: false," in "features.cellMenu.menu.items" also work? At the moment, it does not.

Thanks,
Serghei


Post by ghulam.ghous »

Hi Serghei,

This looks like a bug and I have created ticket here https://github.com/bryntum/support/issues/8805 to investigate and fix this issue. Probably as a workaround for now you can define the named items at cellMenu items level though it might result in code duplication but you can use it untill this issue is fixed:

new Panel({
    appendTo : 'container',
    title    : 'Panel Title',
    height   : 400,
    layout   : 'fit',
    items    : {
        grid : {
            type     : 'grid',
            columns  : [{ field : 'name', text : 'Name' }],
            features : {
                rowCopyPaste : false,
                cellMenu     : {
                    namedItems : {
                        magicButton : {
                            text : 'Magic Button'
                        },
                    },
                    items : {
                        magicButton : true,
                        removeRow   : false
                    }
                }
            },
            data : [
                { id : 1, name : 'First' },
                { id : 2, name : 'Second' },
                { id : 3, name : 'Third' }
            ]
        }
    }
});

Regards,
Ghous


Post Reply