rebuildItemElements method

void rebuildItemElements()

Create and add new GraphObjects corresponding to and bound to the data in the #itemArray, after removing all existing elements from this Panel. This method is automatically called when replacing the #itemArray value, or when changing the value of #itemTemplate or #itemTemplateMap.

This uses #itemCategoryProperty to determine the category for an item data. That string is used to look up a template in #itemTemplateMap. The resulting template (which is also a Panel) is copied, added to this panel, and its #itemIndex is set to its index in that Array. That new child Panel is then data-bound to that Array item by setting its #data.

If #itemArray is null, this method just removes all elements from this panel. Actually, if this Panel #type is "Spot", "Auto", or "Link", the very first element is always kept by this method. Also, if this Panel type is "Table", and if the first element is a "TableRow" or "TableColumn" Panel whose #isPanelMain property is set to true, that first element will be kept too. That is useful for defining literal TableRow headers in Table panels, when the header information is not kept as the first item in the itemArray.

It is wasteful to call this method after making some model data changes. It is better to call Model#setDataProperty, Model#addArrayItem, Model#insertArrayItem, or Model#removeArrayItem, or other model methods. Not only do those methods update efficiently, they also preserve unbound state and support undo/redo.

Implementation

void rebuildItemElements() {
  _i4.callMethod(
    this,
    'rebuildItemElements',
    [],
  );
}