Pivot2 Table Row Custom Sort
In a custom column, add a prefix number followed by a period and a space to the dimensions you want to sort in pivot.
For example, if we have a column called Category with the following categories:
- First Category
- Another Category
Create a custom column called Ordered Category and write:
case
when [Category] = 'First Category' then '1. First Category'
when [Category] = 'Another Category' then '2. Another Category'
end
Use this column in your pivot table.
Next, after creating the pivot table with the correct ordered dimensions we will remove the number and period with the space using the following widget script.
Open the widget script editor and paste:
widget.on('ready', function(){
$('.table-grid__tbody .table-grid__content__inner:contains(. )', element).each(function(i, v){
var thisText = $(this).text()
var periodIndex = thisText.indexOf('.')
var textLength = thisText.length
var returnString = thisText.substring(periodIndex + 2, textLength)
$(this).text(returnString)
})
})
Updated 03-02-2023
intapiuser
Admin
Joined December 15, 2022