Sorting in PivotTable

I am trying to sort the days in my pivotTable according to the sampler example but it’s neither working nor showing any error.

here is my message.properties

function.sorters.dayOfWeek = function(attr){\
if(attr=="Day"){\
    return $.pivotUtilities.sortAs(["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]);\
}\
  }

Hi,

From your screenshot I see that the message key is red, i.e. messageBundle can’t access it. Please check that messagesPack is defined correctly and messageBundle.getMessage(...) returns a value.

Regards,
Gleb

Hi Gleb
It seems to me that the messageBundle is getting the bundle as you can see the context help is showing it
image

In this case, could you please attach the following:

  • Screen XML and controller code
  • Days localization messages, so I can compare them with SortersFunction code

Regards,
Gleb

Hi Gleb
The files are attached.
visitManagementXml.txt (4.2 KB) messageProperties.txt (2.7 KB) VisitManagementController.txt (5.1 KB)

Is the VisitPlan.day attribute is an ENUM, the same as in the mentioned Sampler demo? In your message.properties I don’t see any localization values for Day, so I can’t say if your sorter function is correct.

Hi Gleb
Day is not ENUM, rather generated from the date field when I saved the new record. Do I need to have ENUM even I am not using programmatically?

The sorter function must operate with actual values, e.g. in this demo you can see that messages.properties and messages_ru.properties have different values in the sorter function. Since you generate your days, then you need to generate a sorter function with proper values.

Regards,
Gleb