Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Cgridview Incorrectly Uses Blankdisplay And/or Nulldisplay

$
0
0
I want to discuss this issue here (to make myself sure, that this is a bug), before rising a ticket on Github.

Either I'm missing something or both CGridView->nullDisplay and CGridView->blankDisplay are working incorrectly in current implementation of Yii.

As I understand this functionality, both should be used, when cell is really empty, which means, that there is nothing in it. Right now, it ignores (purges?) HTML entities and is used even, when there are no text, but there is some HTML.

For example, I have such column definition:

array
(
    'name'=>'recommended',
    'value'=>'TextHelper::getGridState($data->recommended)',
    'htmlOptions'=>array('style'=>'width: 30px')
), 

Function used here generates image representation of a state. But since I'm using Font Awesome, this is not a true image (for which I could use any kind of image column), but rather a CSS class that uses special font and styling.

In other words. above mentioned column definition produces for example such code:

<td style="width: 30px">
	<span rel="tooltip" data-delay="500" title="news">
		<i class="icon-comments-alt"></i>
	</span>
</td>

It's clearly not empty, but it does not contain any text. Since that, in current implementation Yii adds $nbsp; between closing </span> and </td>. And I have to either override / change it or use some empty string addition to my value attribute, like that:

'value'=>'TextHelper::getGridState($data->recommended).""',

For me this is wrong. An empty cell means an empty cell. A cell containing HTML code is not ant empty cell and therefore, Yii should not add anything in this case.

Do you agree with me? Is this a bug / issue? Or am I getting these things wrong?

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>