Yii Framework Forum: CButtonColumn buttons.url and buttons.visible - Yii Framework Forum

Jump to content

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

CButtonColumn buttons.url and buttons.visible Rate Topic: -----

#1 User is offline   rinat.io 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 20-January 11

Posted 27 September 2011 - 04:51 AM

Hello guys. I can't figure out why CButtonColumn buttons.url and buttons.visible use different sequence of arguments:

   ...
   'visible' => function($row, $data) { ... },
   'url'     => function($data, $row) { ... },
   ...


Is there some point of this sequence?
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 27 September 2011 - 04:54 AM

This is fixed in the trunk - http://code.google.c...e/detail?r=3402
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   rinat.io 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 20-January 11

Posted 27 September 2011 - 05:24 AM

Thank you mdomba! But why $data is second argument? Does $row really used more then $data? To be honest I've never used $row.
0

#4 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 27 September 2011 - 05:38 AM

different users has different thinking... for you is more important the $data field for someone other is the $row... so my answer is "why not" :D

The $row, $data order is the most used in all other cases that why I stick with it... and for me personally it makes sense... the row we are on... and the data for that row... but that is just my opinion :)
Find more about me.... btw. Do you know your WAN IP?
0

#5 User is offline   rinat.io 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 20-January 11

Posted 27 September 2011 - 07:44 AM

Well, I can't find the situations where 'visible' or 'url' needs $row variable. I thought it's used for css mostly. In any case now it's better then it was. Thank you :)
0

#6 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 23 October 2011 - 04:18 AM

There is an issue for the order of the parameters - http://code.google.c...tail?id=2892#c1

Thinking on reversing the order of parameters... opinions?
Find more about me.... btw. Do you know your WAN IP?
0

#7 User is offline   creocoder 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 199
  • Joined: 09-March 09
  • Location:*.php

Posted 23 October 2011 - 04:55 AM

View Postmdomba, on 23 October 2011 - 04:18 AM, said:

Thinking on reversing the order of parameters... opinions?

Necessarily, or earth will stop rotating. :)

See:

View Postmaschingan, on 27 September 2011 - 05:24 AM, said:

But why $data is second argument? Does $row really used more then $data? To be honest I've never used $row.


+my 5 cents from tracker:

Quote

Given that $row is very rarely used, is much better when the first $data goes.


+4 users starred issue.
No good, no bad, only consequence.
0

#8 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 24 October 2011 - 03:18 PM

This fix has been reverted as it breaks BC - http://code.google.c...e/detail?r=3424
Find more about me.... btw. Do you know your WAN IP?
0

#9 User is offline   creocoder 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 199
  • Joined: 09-March 09
  • Location:*.php

Posted 24 October 2011 - 06:28 PM

In the end we came to where we start :( You previous fix break BC a lot, because you change all signatures to ($row,$data).

How about change only CButtonColumn::buttons.visible? For usage:
visible' => function($data, $row) { ... },


I think that this is the best compromise between not fix and your previous fix.
No good, no bad, only consequence.
0

#10 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 25 October 2011 - 02:06 AM

creocoder

Please decide if to post on the issue or here as it's difficult to follow the same discussion on different places.

I just responded you on the issue thread - http://code.google.c...ail?id=2892#c15
Find more about me.... btw. Do you know your WAN IP?
0

#11 User is offline   rinat.io 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 20-January 11

Posted 25 October 2011 - 07:58 AM

Looks like we come back to different sequence of arguments... Sometimes BC impedes progress ...
0

#12 User is offline   Crend King 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 22-March 11

Posted 26 October 2011 - 07:44 AM

mdomba, you said in Issue 2892 that very few (<= 1%) people use anonymous functions. The reason I use anonymous functions is for complex values. For example, I want to display a radio button list in a CDataColumn with CHtml::radioButtonList. Also, it is easier to debug the code, since Xdebug could break and step in the anonymous functions. For other simple values I stick with string. Do you have any professional suggestion for me? Do everybody only use simple values?

Thanks.
0

#13 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 26 October 2011 - 08:02 AM

This thread is related to the parameter order problem... for other "problems" please open another threads so that we do not complicate this thread with different problems

anonymous functions are available from PHP 5.3 that is not so widespread that's why my estimate of 1% (and by the forum questions regarding them, too)...
but I could be wrong :D
Find more about me.... btw. Do you know your WAN IP?
0

#14 User is offline   creocoder 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 199
  • Joined: 09-March 09
  • Location:*.php

Posted 26 October 2011 - 09:19 AM

mdomba
Maybe it's good idea to add poll to this thread?
No good, no bad, only consequence.
0

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