setDataProperty method

void setDataProperty(
  1. Object data,
  2. String propname, [
  3. dynamic val
])

Change the value of some property of a node data, a link data, an item data, or the Model#modelData, given a string naming the property and the new value, in a manner that can be undone/redone and that automatically updates any bindings.

This gets the old value of the property; if the value is the same as the new value, no side-effects occur. This calls #raiseDataChanged to notify about the change.

Note that it is insufficient to modify an item Array (for example by pushing a new item onto the Array) and then calling setDataProperty(data, "items", data.items) because the value of data.items is still the same reference. Instead you will want to call #insertArrayItem, #addArrayItem, or #removeArrayItem.

If you modify the property that is the #nodeKeyProperty, this will call #setKeyForNodeData.

If you modify the property that is the #nodeCategoryProperty or the GraphLinksModel#linkCategoryProperty, this will call #setCategoryForNodeData or GraphLinksModel#setCategoryForLinkData. But if the category might change, Binding sources should not be (or depend in a conversion function on) the category of the data, because then some bindings might be evaluated before or after the category has been changed. @expose @param {Object} data a JavaScript object typically the value of a Panel#data and represented by a Node, Link, Group, simple Part, or item in a Panel#itemArray; or this model's #modelData. @param {string} propname a string that is not null or the empty string. @param {*} val the new value for the property. @see #set

Implementation

void setDataProperty(
  _i2.Object data,
  _i2.String propname, [
  _i2.dynamic val,
]) {
  _i4.callMethod(
    this,
    'setDataProperty',
    [
      data,
      propname,
      val,
    ],
  );
}