dsmnedc798226 2015-01-26 23:28
浏览 21

CDetailView数据源是yii中的关联数组

If I need to create a table similar to this:

enter image description here

And I have an array:

array (
'0'=>array('year1'=>'2010', 'year2'=>'2010', 'year3'=>'2010' )
'1'=>array('capacity1'=>'5', 'capacity2'=>'10', 'capacity3'=>'15' )
'2'=>array('size1'=>'large', 'size2'=>'small', 'size3'=>'medium' )
'3'=>array('cost1'=>'1', 'cost2'=>'2', 'cost3'=>'3' )
'4'=>array('average_capacity'=>'10', 'average_size'=>'medium', 'average_cost'=>'2' )
)

As I understood, I have to use CDetailView and for that first of all somehow I need to rearrange array like this? And maybe there are some build in function for that? Or I just can't find because there isn't? :(

array (
'0'=>array('year1'=>'2010', 'capacity1'=>'5', 'size1'=>'large', 'cost1'=>'1',  ''=>'')
'1'=>array('year2'=>'2011', 'capacity2'=>'10', 'size2'=>'small','cost2'=>'2', 'average_capacity'=>'10' )
'2'=>array('year3'=>'1012', 'capacity3'=>'15', 'size3'=>'medium','cost3'=>'3', 'average_size'=>'medium')
  )

Or maybe CDetailView is not what I need? There are not a lot of real examples about that view. Tried to find something about horizontal Cgridview where colums in usual usage are rows in my case, but no results. :(

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题