clevertech/YiiBooster — pull request #183 by thiagovidal (2012-12-12 13:50:21+00:00)
Title: 'Undefined offset: 0' error on TbExtendedGridView with sortableRows set to true when table is empty.

Undefined offset: 0

C:\xampp\htdocs\redlion\common\extensions\bootstrap\widgets\TbExtendedGridView.php(244)

232 {
233 parent::renderContent();
234 $this->registerCustomClientScript();
235 }
236
237 /**
238 * Renders the key values of the data in a hidden tag.
239 */
240 public function renderKeys()
241 {
242 $data = $this->dataProvider->getData();
243
244 if(!$this->sortableRows || !$this->getAttribute($data[0], $this->sortableAttribute))
245 {
246 return parent::renderKeys();
247 }
248
249 echo CHtml::openTag('div',array(
250 'class'=>'keys',
251 'style'=>'display:none',
252 'title'=>Yii::app()->getRequest()->getUrl(),
253 ));
254 foreach($data as $d)
255 echo CHtml::tag('span',array('data-order' => $this->getAttribute($d, $this->sortableAttribute), CHtml::encode($this->getPrimaryKey($d))));
256 echo "

\n";