문제

Looking to remove buttons based on data for that row.
Picture 1 - Normal with all buttons
To this where the second line has some data in the table that depicts something.
Picture 2 - With Button removed
I have seen how to color the rows which is nice but need to remove buttons as well. Any thoughts? (sorry for the external links, still a new user)

도움이 되었습니까?

해결책

You can use your data to change visibility of the button columns like this:

replace

array(
  'class'=>'CButtonColumn',
),

with something like this:

array(
  'class'=>'CButtonColumn',
  'template'=>'{view}{update}{delete}',
  'buttons'=>array(
    'update'=>array(
        'visible'=>'$data->cust == "ST50"',
    ),  
  ),  
),  

but it won't keep the spacing when the button is not visible. I'll leave that to you. You can customize other attributes of CButtoncolumn here's a couple of refs: here and here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top