Page 1 of 1

[REACT] Scheduler - can't update resources names dynamically

Posted: Fri Jun 24, 2022 8:25 am
by marasoft@netrom.ro

Hello,

I'm trying to update the resources name dynamically using the following code:

 const resource =this.scheduler.current.instance.resourceStore.getById(this.resourceId);
 // any of these or all together
  resource.data.name = 'newValue';
  resource.originalData.name = 'newValue';
  resource.name = 'newValue';
  this.scheduler.current.schedulerInstance.resourceStore.commit();

However the code inside "columns" => renderer method is not called

See bellow the sample attached.

Thanks in advance!

Best regards.


Re: [REACT] Scheduler - can't update resources names dynamically

Posted: Fri Jun 24, 2022 1:27 pm
by tasnim

I've seen that you're using state, you're changing the value of the store but not the state. You just need to set the changed value to the state Like this :

resource.data.name = 'aaaaaaaaaaaaa';
resource.originalData.name = 'aaaaaaaaaaaaa';
resource.name = 'aaaaaaaaaaaaa';
this.scheduler.current.schedulerInstance.columns.grid.columns.commit();
this.scheduler.current.schedulerInstance.resourceStore.commit();

// you need to add this
this.setState({ resources : this.scheduler.current.schedulerInstance.resourceStore.records });

Re: [REACT] Scheduler - can't update resources names dynamically

Posted: Fri Jun 24, 2022 9:55 pm
by marasoft@netrom.ro

Thanks for the answer, it works great!