As I wrote:
Use Grid.view.mixin.GridSelection#function-deselectRow
And you can use https://bryntum.com/docs/gantt/api/Grid/view/GridBase#function-scrollRowIntoView
As I wrote:
Use Grid.view.mixin.GridSelection#function-deselectRow
And you can use https://bryntum.com/docs/gantt/api/Grid/view/GridBase#function-scrollRowIntoView
Is it used in this way
listeners: {
async selectionChange(changed) {
console.log(changed);
if(changed.action == "deselect"){
const result = await MessageDialog.confirm({
title: 'The big question',
message: 'Do you really want to select?',
okButton: 'Yes',
cancelButton: 'No'
});
if (result != MessageDialog.okButton) {
console.log(changed);
this.scrollRowIntoView()
// call deselect on your row
}
}
}
},
Where gird and Record come from
/**
* Gantt configuration file
*/
import '../lib/GanttToolbar.js';
import '../lib/StatusColumn.js';
import Task from '../lib/Task.js';
import { Gantt, MessageDialog } from '@bryntum/gantt/gantt.lite.umd.js';
const ganttConfig = {
dependencyIdField: 'wbsCode',
listeners: {
beforeEventDelete() {
console.log('delete');
}
},
project: {
// Let the Project know we want to use our own Task model with custom fields / methods
taskModelClass: Task,
autoLoad: false,
// The State TrackingManager which the UndoRedo widget in the toolbar uses
stm: {
autoRecord: true
},
// This config enables response validation and dumping of found errors to the browser console.
// It's meant to be used as a development stage helper only so please set it to false for production systems.
validateResponse: true
},
startDate: '2019-01-12',
endDate: '2019-03-24',
resourceImageFolderPath: 'assets/users/',
columns: [
{ type: 'wbs' },
{ type: 'name', width: 250 },
{ type: 'startdate' },
{ type: 'duration' },
{
type: 'resourceassignment', width: 120, showAvatars: true,
editor: {
picker: {
listeners: {
async selectionChange(changed) {
console.log(changed);
if(changed.action == "deselect"){
const result = await MessageDialog.confirm({
title: 'The big question',
message: 'Do you really want to select?',
okButton: 'Yes',
cancelButton: 'No'
});
if (result != MessageDialog.okButton) {
console.log(changed);
this.scrollRowIntoView()
this.deselectRow()
// call deselect on your row
}
}
}
},
selectionMode: {
rowCheckboxSelection: true,
multiSelect: false,
showCheckAll: false,
},
features: {
filterBar: true,
group: 'resource.orgCode',
headerMenu: false,
cellMenu: false,
},
// The extra columns are concatenated onto the base column set.
// columns: [{
// text: 'Calendar',
// // Read a nested property (name) from the resource calendar
// field: 'resource.name',
// filterable: false,
// editor: false,
// width: 200,
// }],
},
}
},
{ type: 'percentdone', showCircle: true, width: 70 },
{
type: 'predecessor',
width: 112
},
{
type: 'successor',
width: 112
},
{ type: 'schedulingmodecolumn' },
{ type: 'calendar' },
{ type: 'constrainttype' },
{ type: 'constraintdate' },
{ type: 'statuscolumn' },
{
type: 'date',
text: 'Deadline',
field: 'deadline'
},
{ type: 'addnew' }
],
subGridConfigs: {
locked: {
flex: 3
},
normal: {
flex: 4
}
},
columnLines: false,
features: {
rollups: {
disabled: true
},
baselines: {
disabled: true
},
progressLine: {
disabled: true,
statusDate: new Date(2019, 0, 25)
},
filter: true,
dependencyEdit: true,
timeRanges: {
showCurrentTimeLine: true
},
labels: {
left: {
field: 'name',
editor: {
type: 'textfield'
}
}
}
},
tbar: {
type: 'gantttoolbar'
}
};
export default ganttConfig;
An error occurs when I trigger this.deselectrow (changed.selected[0]),you can run my demo and check,thank you!