Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • value1 = first field value to compare.
  • value2 = second field value to compare.
  • fieldName =name of the field that the grid is sorted by. [Available Added in Profound UI Version 5, Fix Pack 6.0 and later]
  • isDescending =true if sorting in descending sequence, false otherwise. [Available Added in Profound UI Version 5, Fix Pack 6.0 and later]
  • fieldDateFormat = date format of the field that the grid is sorted by, if the field is not a date null will be passed instead. [Available in Profound UI Version 5, Fix Pack 14.0 and later]
  • fieldInfo = formatting information of the field that the grid is sorted by; if the field does not contain any formatting information, a blank object will be passed instead. [Available in Profound UI Version 6 and later] 
    • Some of the properties in the field info are:
      • dataType - the field data type
      • dataLength - data length (only present if the field is a character or a numeric field)
      • formatting - field formatting
  • multiFields = When a multi-column sort executes, multiFields will reference an array of information about each column included in the sort. The preferred first sort column is the first entry in the array; the second preferred column is second; etc. This argument is undefined when the sort is for single-column sort executions. [Available in Profound UI Versions After Version 6, Fix Pack 2.1]
    • Properties of each object are the same as described above:
      • fieldName
      • fieldFormat
      • fieldDateFormat
      • value1
      • value2

Return Value:

The function should return a number that tells the grid which row should be placed before the other:

  • Return a positive value (1 or higher) to indicate that value2 should be before value1
  • Return 0  to indicate that the values are equal
  • Return a negative value (-1 or lower) to indicate that value2 should be after value1


Examples:

Code Block
languagejavascript
titleCompare Values as Strings to Sort Grid
pui.gridSort = function( value1, value2, fieldName, isDescending, fieldDateFormat, fieldInfo ) {
  // Custom comparison code would go here.
  // If value1 is greater than value2, return 1, else, return -1.
  if ( value1 > value2 ) return -1;
  else return 1;
}

...