Prado\Web\UI\ActiveControls\TActiveListControlAdapter::setSelectedIndices PHP Method

setSelectedIndices() public method

Selects a list of item based on zero-base indices on the client side.
public setSelectedIndices ( $indices )
    public function setSelectedIndices($indices)
    {
        if ($this->canUpdateClientSide()) {
            $this->updateListItems();
            $n = $this->getControl()->getItemCount();
            $promptValue = $this->getControl()->getPromptValue();
            if ($promptValue === '') {
                $promptValue = $this->getControl()->getPromptText();
            }
            $list = array();
            foreach ($indices as $index) {
                $index = intval($index);
                if ($promptValue !== '') {
                    $index++;
                }
                if ($index >= 0 && $index <= $n) {
                    $list[] = $index;
                }
            }
            if (count($list) > 0) {
                $this->getPage()->getCallbackClient()->select($this->getControl(), 'Indices', $list);
            }
        }
    }