Prado\Collections\TListItemCollection::insertAt PHP Метод

insertAt() публичный Метод

Inserts an item into the collection.
public insertAt ( $index, $item )
    public function insertAt($index, $item)
    {
        if (is_string($item)) {
            $item = $this->createNewListItem($item);
        }
        if (!$item instanceof TListItem) {
            throw new TInvalidDataTypeException('listitemcollection_item_invalid', get_class($this));
        }
        parent::insertAt($index, $item);
    }

Usage Example

Пример #1
0
 /**
  * Inserts an item into the collection.
  * The new option is added on the client-side during callback.
  * @param integer the location where the item will be inserted.
  * The current item at the place and the following ones will be moved backward.
  * @param TListItem the item to be inserted.
  * @throws TInvalidDataTypeException if the item being inserted is neither a string nor TListItem
  */
 public function insertAt($index, $value)
 {
     parent::insertAt($index, $value);
     if ($this->canUpdateClientSide()) {
         $this->_hasChanged = true;
     }
 }