window.modulegrid = new Grid({
class ActionModel extends Model {
static get fields () {
return [
{ name : 'id', type : 'number' },
{ name : 'step', type : 'number' },
'action',
'outcome',
'aboveId'
];
}
}
appendTo : 'module-grid',
features : {
rowResize: true,
cellEdit : { addNewAtEnd : true },
cellMenu : {
items : {
insertAbove : {
text : 'Insert above',
icon : 'b-fa b-fa-arrow-up',
weight : 10,
onItem : ({ record }) => insertRow(record)
},
}
}
},
columns : [
{
text : 'Step',
field : 'step',
autoHeight : true,
width : 80,
hidden: true,
},
{
text : 'Action',
field : 'action',
editor : {
type : 'MultiLineTextEditor',
},
autoHeight : true,
width : 350,
resizable: true,
cellCls : 'multiline-cell',
},
{
text : 'Outcome',
field : 'outcome',
editor : {
type : 'MultiLineTextEditor'
},
autoHeight : true,
width : 250,
resizable: true,
cellCls : 'multiline-cell',
}
],
store : {
modelClass : ActionModel,
autoLoad : true,
autoCommit : true,
readUrl : `v7.do?actionRefId=3050&orgId=${orgId}`, // GET → JSON list
updateUrl : `v7.do?actionRefId=3051&orgId=${orgId}`,
createUrl : `v7.do?actionRefId=3052&orgId=${orgId}`,
deleteUrl : `v7.do?actionRefId=3053&orgId=${orgId}`,
}
});
If I right click insert
async function insertRow(targetRecord) {
const store = window.modulegrid.store;
const index = store.indexOf(targetRecord); // current row
const newRec = {
aboveId : targetRecord.id, // above this row
};
// store.insert(<index>, data) ⇢ returns the inserted record
const [rec] = store.insert(index, newRec);
// put focus where the user expects it
const actionColumn = window.modulegrid.columns.find(c => c.field === 'action');
window.modulegrid.startEditing({ record : rec, column : actionColumn });
}
it adds the record fine, with an id
{
"success": true,
"data": [
{
"id": "27497091",
"action": "whynote",
"outcome": "",
"step": 12
}
],
"total": 0
}
I can update the field and it updates it just fine.
But right click delete will do nothing, no console errors, no network activity.
It is only after reloading the store that I can right click delete anything.
I checked the record added, doesnt say phantom or commiting or anything obvious. It has an id.