Premium support for our pure JavaScript UI components


Post 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.

Attachments
ChangeResourcesNameDynamically.zip
(2.78 MiB) Downloaded 30 times

Post 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 });

Post by marasoft@netrom.ro »

Thanks for the answer, it works great!


Post Reply