2014-02-28 64 views
0

工作,我有工作和演算值爲和分頁設置爲18警予cgridview表達式求值不會對分頁

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'projects-grid', 
    'dataProvider'=>$model->search(false), 
    'filter'=>$model, 
    'rowCssClassExpression'=>'($data->PERCENT == 100)? "yellow" : ($row%2?"even":"odd")', 
    'columns'=>array(
     array(
      'name' => 'PROJID', 
      'htmlOptions' => array('style'=>'width:70px'), 
     ), 
     array(
      "header"=>"Client", 
      "value"=>' ($data->oRDERNO->ACCOUNTID == "")? "" : (isset($data->oRDERNO->aCCOUNTold->COMPANY))? $data->oRDERNO->aCCOUNTold->COMPANY: (isset($data->oRDERNO->aCCOUNTsugar->name)) ? $data->oRDERNO->aCCOUNTsugar->name : "" ',//'(strlen($data->oRDERNO->ACCOUNTID)>10) ? $data->oRDERNO->aCCOUNTsugar->name : ""',//(isset($data->oRDERNO->aCcounts0->COMPANY)) ? $data->oRDERNO->aCcounts0->COMPANY : "" ' 
     ), 
     array(
      'name' => 'PROJECT', 
      'header'=>"Project", 
      'type' => 'raw', 
      'filter'=>$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
       'attribute'=>'PROJECT', 
       'model'=>$model, 
       'name'=>'Projects[PROJECT]', 
       'options'=>array(
         'minLength'=>'2', 
       ), 
        'htmlOptions'=>array(
          'id' => 'Projects_PROJECT_search' 
        ), 
      ),true), 
     ), 
     'country', 
     array(
      'class'=>'CButtonColumn', 
      'template'=>'{update}{view}', 
      'htmlOptions' => array('style'=>'width:5px'), 
      //"style"=>"width:5px" 
      'buttons'=>array(
        'update'=>array(
          'visible'=>'(isset($data->oRDERNO->ACCOUNTID)) ? (strlen($data->oRDERNO->ACCOUNTID)>10) ? true :false: false', 
        ), 
        /*'view'=>array(
          'visible'=>'(isset($data->oRDERNO->ACCOUNTID)) ? (strlen($data->oRDERNO->ACCOUNTID)>10) ? true :false: false', 
        ),*/ 
      ), 

     ),  
    ), 
)); ?> 

如何以往當我嘗試旁邊顯示了一號18個結果如下CGRID視圖它錯誤。

<h1>PHP Error [8]</h1> 
<p>Trying to get property of non-object (/opt/yii-1.1.14.f0fee9/framework/base/CComponent.php(612) : eval()'d code:1)</p> 
<pre>#0 /opt/yii-1.1.14.f0fee9/framework/base/CComponent.php(612) : eval()'d code(1): CWebApplication->handleError() 
#1 /opt/yii-1.1.14.f0fee9/framework/base/CComponent.php(612): eval() 
#2 /opt/yii-1.1.14.f0fee9/framework/zii/widgets/grid/CDataColumn.php(137): CDataColumn->evaluateExpression() 
#3 /opt/yii-1.1.14.f0fee9/framework/zii/widgets/grid/CGridColumn.php(151): CDataColumn->renderDataCellContent() 
#4 /opt/yii-1.1.14.f0fee9/framework/zii/widgets/grid/CGridView.php(616): CDataColumn->renderDataCell() 
#5 /opt/yii-1.1.14.f0fee9/framework/zii/widgets/grid/CGridView.php(572): CGridView->renderTableRow() 
#6 /opt/yii-1.1.14.f0fee9/framework/zii/widgets/grid/CGridView.php(482): CGridView->renderTableBody() 
#7 /opt/yii-1.1.14.f0fee9/framework/zii/widgets/CBaseListView.php(167): CGridView->renderItems() 
#8 unknown(0): CGridView->renderSection() 
#9 /opt/yii-1.1.14.f0fee9/framework/zii/widgets/CBaseListView.php(150): preg_replace_callback() 
#10 /opt/yii-1.1.14.f0fee9/framework/zii/widgets/CBaseListView.php(135): CGridView->renderContent() 
#11 /opt/yii-1.1.14.f0fee9/framework/web/CBaseController.php(173): CGridView->run() 
#12 /opt/paradox/protected/views/projects/entry.php(90): ProjectsController->widget() 
#13 /opt/yii-1.1.14.f0fee9/framework/web/CBaseController.php(126): require() 
#14 /opt/yii-1.1.14.f0fee9/framework/web/CBaseController.php(95): ProjectsController->renderInternal() 
#15 /opt/yii-1.1.14.f0fee9/framework/web/CController.php(869): ProjectsController->renderFile() 
#16 /opt/yii-1.1.14.f0fee9/framework/web/CController.php(782): ProjectsController->renderPartial() 
#17 /opt/paradox/protected/controllers/ProjectsController.php(811): ProjectsController->render() 
#18 /opt/yii-1.1.14.f0fee9/framework/web/actions/CInlineAction.php(49): ProjectsController->actionAdmin() 
#19 /opt/yii-1.1.14.f0fee9/framework/web/CController.php(308): CInlineAction->runWithParams() 
#20 /opt/yii-1.1.14.f0fee9/framework/web/CController.php(286): ProjectsController->runAction() 
#21 /opt/yii-1.1.14.f0fee9/framework/web/CController.php(265): ProjectsController->runActionWithFilters() 
#22 /opt/yii-1.1.14.f0fee9/framework/web/CWebApplication.php(282): ProjectsController->run() 
#23 /opt/yii-1.1.14.f0fee9/framework/web/CWebApplication.php(141): CWebApplication->runController() 
#24 /opt/yii-1.1.14.f0fee9/framework/base/CApplication.php(180): CWebApplication->processRequest() 
#25 /opt/paradox/index.php(31): CWebApplication->run() 
</pre> 
+0

究竟你在哪裏得到這個錯誤?該行可能會突出顯示爲紅色或粉紅色 –

回答

0

那麼,我相信你的第二頁上你缺少的東西。 1例子可能是 $ data-> oRDERNO-> ACCOUNTID不存在。如果沒有$ data-> oRDERNO,那麼訪問$ data-> oRDERNO-> ACCOUNTID就會拋出一個錯誤,你完全看不到它。嘗試訪問瀏覽器中的第二頁,看看是否是這種情況。

+0

所有'$ data'記錄都與'oRDERNO'關係 – shorif2000

+0

只需轉到第二頁並查看完整的錯誤。 (在分頁上,在新標籤中打開)。如果不是這樣,那麼它就是這樣的。 –

+0

它不會讓我瀏覽到第二頁。我收到的錯誤是我上面發佈的 – shorif2000