我有一个带有表格输入的_form视图,如下所示:
Aspect1
city1 city2 city3
------------------------------------------------------------------------------------
1. cond1.1 [dropwown(1,2,3) as k1] | [dropwown(1,2,3) as k1] | [dropwown(1,2,3) as k1]
2. cond1.2 [dropwown(1,2,3) as k2] | [dropwown(1,2,3) as k2] | [dropwown(1,2,3) as k2]
3. cond1.3 [dropwown(1,2,3) as k3] | [dropwown(1,2,3) as k3] | [dropwown(1,2,3) as k3]
4. cond2.1 [dropwown(1,2,3) as k4] | [dropwown(1,2,3) as k4] | [dropwown(1,2,3) as k4]
5. cond2.2 [dropwown(1,2,3) as k5] | [dropwown(1,2,3) as k5] | [dropwown(1,2,3) as k5]
6. cond3.1 [dropwown(1,2,3) as k6] | [dropwown(1,2,3) as k6] | [dropwown(1,2,3) as k6]
7. cond3.1 [dropwown(1,2,3) as k7] | [dropwown(1,2,3) as k7] | [dropwown(1,2,3) as k7]
Aspect2
city1 city2 city3
------------------------------------------------------------------------------------
1. cond1.1 [dropwown(1,2,3) as e1] | [dropwown(1,2,3) as e1] | [dropwown(1,2,3) as e1]
2. cond1.2 [dropwown(1,2,3) as e2] | [dropwown(1,2,3) as e2] | [dropwown(1,2,3) as e2]
3. cond1.3 [dropwown(1,2,3) as e3] | [dropwown(1,2,3) as e3] | [dropwown(1,2,3) as e3]
4. cond2.1 [dropwown(1,2,3) as e4] | [dropwown(1,2,3) as ke] | [dropwown(1,2,3) as e4]
5. cond2.2 [dropwown(1,2,3) as e5] | [dropwown(1,2,3) as ke] | [dropwown(1,2,3) as e5]
Aspect3
city1 city2 city3
------------------------------------------------------------------------------------
1. cond1.1 [dropwown(1,2,3) as s1] | [dropwown(1,2,3) as s1] | [dropwown(1,2,3) as s1]
2. cond1.2 [dropwown(1,2,3) as s2] | [dropwown(1,2,3) as s2] | [dropwown(1,2,3) as s2]
3. cond1.3 [dropwown(1,2,3) as s3] | [dropwown(1,2,3) as s3] | [dropwown(1,2,3) as s3]
4. cond2.1 [dropwown(1,2,3) as s4] | [dropwown(1,2,3) as s4] | [dropwown(1,2,3) as s4]
5. cond2.2 [dropwown(1,2,3) as s5] | [dropwown(1,2,3) as s5] | [dropwown(1,2,3) as s5]
6. cond3.1 [dropwown(1,2,3) as s6] | [dropwown(1,2,3) as s6] | [dropwown(1,2,3) as s6]
我从这个链接中学习:http://www.yiiframework.com/doc/guide/1.1/en/form.table 没有理解它是如何做的。
请帮帮我。
这是我的输出html:
aspect1
<select style="width: 50px" name="Evaluation[1][k1]" id="Evaluation_1_k1">
.
.
.
<select style="width: 50px" name="Evaluation[7][k1]" id="Evaluation_7_k1">
aspect2
<select style="width: 50px" name="Evaluation[1][e1]" id="Evaluation_1_e1">
.
.
.
<select style="width: 50px" name="Evaluation[5][e1]" id="Evaluation_5_e1">
aspect3
<select style="width: 50px" name="Evaluation[1][s1]" id="Evaluation_1_s1">
.
.
.
<select style="width: 50px" name="Evaluation[6][s1]" id="Evaluation_6_s1">
在我的_form中我没有使用foreach语句,我使用标准循环来生成那些html代码。 并且在我的控制器中仍然使用与gii生成的相同。