Prado\Web\UI\WebControls\TListControl::setSelectedValue PHP Method

setSelectedValue() public method

Existing selections will be cleared if the item value is found in the item collection. Note, if the value is null, existing selections will also be cleared.
public setSelectedValue ( $value )
    public function setSelectedValue($value)
    {
        if ($this->_items) {
            if ($value === null) {
                $this->clearSelection();
            } else {
                if (($item = $this->_items->findItemByValue($value)) !== null) {
                    $this->clearSelection();
                    $item->setSelected(true);
                } else {
                    $this->clearSelection();
                }
            }
        }
        $this->_cachedSelectedValue = $value;
        if ($this->getAdapter() instanceof IListControlAdapter) {
            $this->getAdapter()->setSelectedValue($value);
        }
    }