[SOLVED] Multiselect Issue, react+redux

Hi!

I’m having an issue with the ‘onTaskMultiSelect’ event. When I put a logic to send a callback through a prop to the parent container, and I try to select multiple rows, on the backgroud the rows are actually selected, but on the gantt view just one row is selected.

What can be happen? Is this a known issue?

Thanks in advance!

Hello,
I suppose it might happen because Gantt doesn’t save selected task highlight. Please try to add the following code:
https://docs.dhtmlx.com/gantt/desktop__multiselection.html#checkingifataskisselected
You can see how it works in the following snippet:
https://snippet.dhtmlx.com/a849c4ace

If that doesn’t help you, please send me your react package so that I can reproduce it locally and see what might be wrong.

1 Like

Hi!

Yes, the problem is that the grid is not highlited, but the tasks are actually selected on the background (gantt.getselectedtasks())

The problem is actually this: https://puu.sh/Bq8HV/39b29fe8d5.mp4

Thanks!

Hello,
Thank you for the clarification.
Did the method from my previous message (with templates) help you?

1 Like

Lots of thanks Ramil!

The next code works for me:

componentDidMount() {
gantt.config.multislect = true;
this.initGanttEvents();
gantt.init(this.ganttContainer);
gantt.templates.task_class = gantt.templates.grid_row_class = gantt.templates.task_row_class = function (start, end, task) {
  if (gantt.isSelectedTask(task.id)) return "gantt_selected";
};
if (this.props.tasks) {
  gantt.layout = (this.props.config.layout);      
  gantt.parse(this.props.tasks);
}

}