I am semi-frustrated with this Yii CGridView problem and any help or guidance would be highly appreciated.
我有两张相关表格(商店——直面小学)和联系(商号——外国),这样一家商店可以有多个联系。 采用“CGridview”将记录和分类以及我在商店模式中的关系功能等同:
shopscontact => array(self::HAS_MANY, Shopsmodel , shop_id );
On the shop grid, I need to display the shop row with any one of the available contacts. My attempt to filter, search the Grid has worked pretty fine, but I m stuck in one very strange problem. The respective grid column does not display the value that is intended.
在CGridview档案中,Im从事类似事情。
array(
name => shopscontact.contact_firstname ,
header => First Name ,
value => $data->shopscontact->contact_firstname
),
页: 1 然而,即使在搜查/护送工作(我通过检查 d协会发现)的情况下,电网栏也空洞! 而且,当我做一个var时,我就把 子_死。
array(
name => shopscontact.contact_firstname ,
header => First Name ,
value => var_dump($data->shopscontact)
),
The dump shows record values in _private attributes as follows:
private _attributes (CActiveRecord) =>
array
contact_firstname => string rec1 (length=4)
contact_lastname => string rec1 lsname (length=11)
contact_id => string 1 (length=1)
< Edit: >
My criteria code in the model is as follows:
$criteria->with = array(
owner ,
states ,
shopscontacts => array(
alias => shopscontacts ,
select => shopscontacts.contact_firstname,shopscontacts.contact_lastname ,
together => true
)
);
以及
我如何利用各自栏目中的数值? 请帮助!