hi there!

in the file "views_plugin_row_fields_exhibit.inc" there is a check, that just non-empty values are rendered. As Views at the moment does not provide the possibility to define default values for a field, this can cause that some values are skipped - even if not wanted. In the end, this behavior crashes the sorting of numerical fields, because empty fields come after (and not before) all other values, if you sort ascending.

For example: I have a list of nodes in the view and include the number of times this node was viewed ("totalcount") as a field. If a node was never viewed so far, the .totalcount field is empty and not rendered in the exhibit JSON. When I want to sort on totalcount (ascending), the nodes which where never viewed come last, and not first - as it would supposed to be.

When i render even empty values, then they have the value '0' in the resulting JSON and the sorting works.

The attached patch simply removes the if(!empty($value)) check. Probably there is a better way?

best,
walter

Comments

valderama’s picture

Status: Active » Needs review
valderama’s picture

Status: Needs review » Fixed

in views 2.7 you can choose wheter you want to hide a field if it is empty or 0. i think that this problem is solved now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.