Hello,
Trying to pop the context menu of a row record on the grid (scheduler) with a left cell click instead of right click but for the sake of simplicity, here is a sample taken from https://bryntum.com/examples/grid/basic/
Another support ticket shows to use
event.id = event.record.id;
grid.features.cellMenu.showContextMenu(event);
but it does not work.
Support ticket : viewtopic.php?f=51&t=19532&p=96642&hilit=showcontextmenu#p96642
With update to the example with following code :
import { Grid, DataGenerator } from '../../build/grid.module.js?459414';
import shared from '../_shared/shared.module.js?459414';
new Grid({
appendTo : 'container',
features : {
group : false,
cellMenu : true
},
// Headers will ripple on tap in Material theme
ripple : {
delegate : '.b-grid-header'
},
listeners : {
cellclick : function(event) {
event.id = event.record.id;
event.source.features.cellMenu.showContextMenu(event)
}
},
columns : [
{
text : 'Name',
field : 'name',
flex : 2,
editor : {
type : 'textfield',
required : true
}
}, {
text : 'Age',
field : 'age',
width : 100,
type : 'number'
}, {
text : 'City',
field : 'city',
flex : 1
}, {
text : 'Food',
field : 'food',
flex : 1
}, {
text : 'Color (not sortable)',
field : 'color',
flex : 1,
sortable : false,
renderer({ cellElement, value }) {
// renderer that sets text color = text
cellElement.style.color = value;
return value;
}
}
],
data : DataGenerator.generateData(50)
});
an error shows :
Uncaught TypeError: Cannot read properties of undefined (reading 'x')
I've also tried ways proposed here :https://github.com/bryntum/support/issues/868 without success.
Any help would be appreciated to simply being able to reuse the same contextMenu (which works on right click) but on a button click, a cell click, an action column, or whichever..
Thanks,
Hugo