update()
updates properties of the item
update(id: string | number, item: object, silent?: boolean): void;
Parameters:
id: string | number- the ID of an itemitem: object- new properties for an itemsilent?: boolean- optional, if set to true, the method will be called without triggering events, false by default
info
Note that after calling the method with the silent:true parameter, you may need to repaint the component with the paint() method.
Example
toolbar.data.update("add_btn", { value:"Add new" });
Also note, that for correct work of the method the last update of a data collection should be done with the silent:false setting applied, for example:
const itemsForUpdate = [...]; // items { ... }
const lastIndex = itemsForUpdate.length - 1;
itemsForUpdate.forEach((item, index) => {
data.update(item.id, {
param: "change param",
}, index != lastIndex); // the last update isn't silent, as the `silent:false` parameter is set
});