Dear Sirs,
I add a "Reset" button to the grid editing top bar, which has Add, Delete, Edit buttons as well.
Did some test and found that the grid.store.revertChanges() will revert the changes made by Add and Delete, but not the Edit.
Please advise if this is the designed behavior or not.
Or what should I do in the Edit function so that reverChanges can take effect.
PS. Please also advise the name of the reset icon.
Thanks!
Scott Lin
{
type : 'button',
ref : 'resetButton',
icon : 'b-fa-reset',
text : 'Reset',
disabled : false,
tooltip : 'Reset changes (added, modified and removed rows)',
onAction : async() => {
grid.store.revertChanges();
Toast.show('Changes reverted');
}
},
This is the code to update the grid.selectedRecord.data with the FieldSet input data:
const populationForm = new FieldSet({
appendTo : 'container',
title : 'Population Editor',
width : '5em',
hidden: false,
collapsible: { direction: 'left' },
scrollable: true,
items: [
{ id: 'id', type: 'text', label : 'Id' },
{ id: 'country', type: 'text', label : 'Country' },
{ id: 'population', type: 'number', label : 'Population' },
{ id: 'yearlychange', type: 'number', label : 'Yearly Change' },
{ id: 'netchange', type: 'number', label : 'Net Change' },
{ id: 'density', type: 'number', label : 'Density' },
{ id: 'area', type: 'number', label : 'Area' },
{ id: 'migrants', type: 'number', label : 'Migrants' },
{ id: 'fert', type: 'number', label : 'Fert' },
{ id: 'age', type: 'number', label : 'Age' },
{ id: 'urban', type: 'number', label : 'Urban' },
{
type : 'button',
text : 'Apply',
style : 'margin:2em 0 1em 0',
onClick() {
grid.selectedRecord.data = populationForm.values;
}
}
]
});