Yii Framework Forum: grouping dropdownlist - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

grouping dropdownlist Rate Topic: -----

#1 User is offline   ilzale 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 113
  • Joined: 08-October 08

Posted 21 October 2008 - 10:22 AM

giving to the listdata method the parameter to group items in a activeDropDownList return an exception Invalid argument supplied for foreach() at line 886 of CHtml file.

rel 100.
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,901
  • Joined: 04-October 08
  • Location:DC, USA

Posted 21 October 2008 - 10:29 AM

More details on how to reproduce this?
0

#3 User is offline   ilzale 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 113
  • Joined: 08-October 08

Posted 21 October 2008 - 11:01 AM


<?php echo CHtml::activeDropDownList($job_orders,'jbr_customer',
CHtml::listData(CActiveRecord::model(customers)->findAll(),
cst_pk,cst_description,cst_number),
array('prompt'=>'seleziona')); ?>


where customers is a table with cst_pk as primary key, and cst_description and cst_number as fields. as you can see i'm trying to group by cst_number
0

#4 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,901
  • Joined: 04-October 08
  • Location:DC, USA

Posted 21 October 2008 - 01:07 PM

From the code, I can't see any problem. Could you print_r(CHtml::listData(...))? Line 886 is complaining that the list data is not an array.

What is cst_pk, cst_description? are they string or constant?

It is also recommended that you use customers::model() instead of CActiveRecord::model(customers).
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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