Question

I have the following cgrid view which works and evalutes and displays the 1st 18 results as pagination is set to 18.

<?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',
                    ),*/
            ),  

        ),      
    ),  
)); ?>

How ever when i try to got next it errors.

<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>

No correct solution

OTHER TIPS

Well, I believe on your second page you are missing things. 1 example might be that $data->oRDERNO->ACCOUNTID is not existent. If there is no $data->oRDERNO then accessing $data->oRDERNO->ACCOUNTID would thrown an error exactly how you see it. try getting to the second page in the browser to see that this is the case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top