Search code examples
gridviewyiiyii-extensions

Grid view with columns from multiple tables but unable to display image in the gridview


cant display image in the gridview wherein this grid view with columns from multiple tables .. following is what i have done am using EImageColumn..... i dont no where am i wrong ...... can any one please guide me

gridview in model2

  tbl2 columns
 array('header'=>'Pimg', 'value'=>array(
        'class'=>'EImageColumn',
        'name' => 'pimg',   //name of column from tbl1 and model1
        'htmlOptions' => array('style' => 'width: 100px;'),

        )), 
   tbl3 columns

can any one please guide me

if i place the above code i get this error

**call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members**

Solution

  • The class,name and htmlOptions should not be in the value array, just like in http://www.yiiframework.com/extension/image-column/

    array(
        'header'=>'Pimg', 
        'class'=>'EImageColumn',
        'name' => 'm1.pimg', //assuming the relation to model1 in model2 is named m1
        'htmlOptions' => array('style' => 'width: 100px;'),
        'value'=>'...',// if required
    ),