cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting Table

LM
7 - Data Storage
7 - Data Storage

Hello,

I have created an "Aggregated Table" widget using this plugin.

Using this, sorting the table by only one column is supported.

Is it possible to sort the table based on 2 columns in descending order? Perhaps something can be done using widget script? 

Kindly share any possible solution.

2 REPLIES 2

Angelina_QBeeQ
10 - ETL
10 - ETL

Hi @LM ,

We can add one more column to the table for sorting.
It can have different content:

  • you can concatenate the fields you need to sort  into one.
  • you can use the "Ordering" function.

Angelina_0-1677656655860.png

  • create your own field for sorting.

After that, you will need to sort the table by this field.
We can add a script to hide that cutom column.
And in order to prevent the user from accidentally sorting by other fields, we will hide sorting from headers.

 

let colIndex = 0;

widget.on("render", function(se,ev){
 se.style.tableState.columns[colIndex].visible = false;
 
})


widget.on('domready',function(){
 	$('.tw-sort-head ', element).css('display', 'none');
})

 

I hope this helps or points you in the right direction.

Always here to help,
Angelina from QBeeQ
[email protected]

LM
7 - Data Storage
7 - Data Storage

Hi @Angelina_QBeeQ,

Thanks for the reply.

I tried the different ways you suggested, they are not working as required for us.

Can we sort the table based on two columns using widget script only without the need to add any hidden columns  ?

Thanks,
LM