Prado\Web\UI\ActiveControls\TActiveListControlAdapter::setSelectedIndex PHP 메소드

setSelectedIndex() 공개 메소드

Selects an item based on zero-base index on the client side.
public setSelectedIndex ( $index )
    public function setSelectedIndex($index)
    {
        if ($this->canUpdateClientSide()) {
            $this->updateListItems();
            // if a prompt is set, we mimic the postback behaviour of not counting it
            // in the index. We assume the prompt is _always_ the first item (Issue #368)
            $promptValue = $this->getControl()->getPromptValue();
            if ($promptValue === '') {
                $promptValue = $this->getControl()->getPromptText();
            }
            if ($promptValue !== '') {
                $index++;
            }
            if ($index >= 0 && $index <= $this->getControl()->getItemCount()) {
                $this->getPage()->getCallbackClient()->select($this->getControl(), 'Index', $index);
            }
        }
    }