public function setViewModel(ViewModel $viewModel)
    {
        if ($this->viewModel !== null) {
            throw new \Exception(
                'A viewModel is already set. Did you already called ' .
                '$grid->render() or $grid->getViewModel() before?'
            );
        }

        $this->viewModel = $viewModel;
    }
public function setViewModel(ViewModel $viewModel)
    {
        if ($this->viewModel !== null) {
            throw new \Exception(
                'A viewModel is already set. Did you already called ' .
                '$grid->render() or $grid->getViewModel() before?'
            );
        }

        $this->viewModel = $viewModel;
    }
public function setViewModel ( ViewModel $ viewModel ) { if ( $ this -> viewModel !== null ) { throw new \ Exception ( 'A viewModel is already set. Did you already called ' . '$grid->render() or $grid->getViewModel() before?' ) ; } $ this -> viewModel = $ viewModel ; }
Set a custom ViewModel...generally NOT necessary!

@param ViewModel $viewModel

@throws \Exception
Set a custom ViewModel ... generally NOT necessary!