The variable pui.gridSort can be used to customize the client-side grid column sort by defining a sort function.
Provided Parameters
The following parameters values are passed provided to this function as passed parameters:
- value1 = first field value to compare.
- value2 = second field value to compare.
- fieldName =name of the field that the grid is sorted by. (Available in [Available Added in Profound UI Version 5, Fix Pack 6.0 and later)]
- isDescending =true if sorting in descending sequence, false otherwise. (Available in [Available Added in Profound UI Version 5, Fix Pack 6.0 and later)]
- fieldDateFormat 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 in Profound UI Version 5, Fix Pack 14.0 and later)fieldInfolater]
- 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 [Available in Profound UI Version 6 and later)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
- Some of the properties in the field info are:
- multiFieldsmultiFields = When a multiplemulti-column sort runs, this is executes, multiFields will reference an array of information about each column included in the sort. The preferred first preferred 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 a for single-column . (Available in sort executions. [Available in Profound UI Versions After Version 6, Fix Packs later than Pack 2.1)]
- Properties of each object are the same as described above:
- fieldName
- fieldFormat
- fieldDateFormat
- value1
- value2
- Properties of each object are the same as described above:
Example:
...
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 | ||||
---|---|---|---|---|
| ||||
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; } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
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.
return ( ( value1 > value2 ) ? 1 : -1 );
}
|
Info |
---|
Where do you save this configuration option? Here |