Yii Framework Forum: Creating a new column in a GridView - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Creating a new column in a GridView

#1 User is offline   santanna106 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 18-April 12

Posted 10 December 2014 - 03:46 AM

I created a new column in a GridView filled for a description recovered through a join.

I build a method gridProdutoMarca($data,$row) in class ProductController to recover a description. But I'm not getting rename
the column for any name. When change the name the following error occurs

Property "Produto.Marca" is not defined.


OBS1: If I put the column name as idMarca the code works correctly. How can I rename this column?

OBS2: I followed the tutorial
http://www.yiiframew...ex-datacolumns/

OBS3: to add the column in gridView I inserted the code below in the GridView columns field


'columns'=>array(
		//'id',
		//'idMarca',
		'codReferencia',
		array(
            'name'=>'Marca',
			'type'=>'raw', //because of using html-code
            'value'=>array($this,'gridProdutoMarca'),  //call this controller method for each row
         ),

0

#2 User is offline   santanna106 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 18-April 12

Posted 11 December 2014 - 01:46 AM

View Postsantanna106, on 10 December 2014 - 03:46 AM, said:

I created a new column in a GridView filled for a description recovered through a join.

I build a method gridProdutoMarca($data,$row) in class ProductController to recover a description. But I'm not getting rename
the column for any name. When change the name the following error occurs

Property "Produto.Marca" is not defined.


OBS1: If I put the column name as idMarca the code works correctly. How can I rename this column?

OBS2: I followed the tutorial
http://www.yiiframew...ex-datacolumns/

OBS3: to add the column in gridView I inserted the code below in the GridView columns field


'columns'=>array(
		//'id',
		//'idMarca',
		'codReferencia',
		array(
            'name'=>'Marca',
			'type'=>'raw', //because of using html-code
            'value'=>array($this,'gridProdutoMarca'),  //call this controller method for each row
         ),





I got resolve

was enough include into the row below in gridView

array(
'name' => 'Marca',
'value' => '$data->Marca->nomeMarca',
),
0

#3 Guest_ojongantuk_*

  • Group: Guests

Posted 25 December 2014 - 12:28 PM

Bagus nih bray postingannya .............
sekalian numpang iklan buat informasi yang suka sepak bola........................
Bagi yang gak suka ya mohon jangan ngusik, terima kasih..................
Informasi seputar sepak bola hanya disini tempatnya ......................

hasilakhir.com Berita Sepak Bola, Warta Bola Terbaru, Agen Koran Olahraga
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users