Prado\Web\UI\WebControls\TRepeater::performDataBinding PHP Method

performDataBinding() protected method

This method is invoked by dataBind(). You may override this function to provide your own way of data population.
protected performDataBinding ( $data )
    protected function performDataBinding($data)
    {
        $this->reset();
        $keys = $this->getDataKeys();
        $keys->clear();
        $keyField = $this->getDataKeyField();
        $items = $this->getItems();
        $itemIndex = 0;
        $hasSeparator = $this->_separatorTemplate !== null || $this->getSeparatorRenderer() !== '';
        foreach ($data as $key => $dataItem) {
            if ($keyField !== '') {
                $keys->add($this->getDataFieldValue($dataItem, $keyField));
            } else {
                $keys->add($key);
            }
            if ($itemIndex === 0) {
                $this->_header = $this->createItemWithDataInternal(-1, TListItemType::Header, null);
            }
            if ($hasSeparator && $itemIndex > 0) {
                $this->createItemWithDataInternal($itemIndex - 1, TListItemType::Separator, null);
            }
            $itemType = $itemIndex % 2 == 0 ? TListItemType::Item : TListItemType::AlternatingItem;
            $items->add($this->createItemWithDataInternal($itemIndex, $itemType, $dataItem));
            $itemIndex++;
        }
        if ($itemIndex > 0) {
            $this->_footer = $this->createItemWithDataInternal(-1, TListItemType::Footer, null);
        } else {
            $this->createEmptyContent();
            $this->dataBindChildren();
        }
        $this->setViewState('ItemCount', $itemIndex, 0);
    }