Author Topic: Is it possible to Lock sorting on one field while sorting other fields?  (Read 2142 times)

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Hi team, your support is quick and awesome. Thanks for this.

However, I have an issue, I want to lock sorting on a field while sorting other fields. Please see below example for your reference,

col1|col2|col3|col4  |
-----------------------
p4  | m4| R1 | val2 |
p1  | m3| R2 | val1 |
p3  | m1| R3 | val4 |
p2  | m2| R4 | val3 |

I want col3 always be always R1, R2, R3, R4 even when i am sorting col4, col2, col1. i.e when col4 is sorted, result should be like this,

Sorting Col4
--------------
col1|col2|col3|col4  |
-----------------------
p1  | m3| R1 | val1 |
p4  | m4| R2 | val2 |
p2  | m2| R3 | val3 |
p3  | m1| R4 | val4 |

Sorting Col2
--------------
col1|col2|col3|col4  |
-----------------------
p3  | m1| R1 | val4 |
p2  | m2| R2 | val3 |
p1  | m3| R3 | val1 |
p4  | m4| R4 | val2 |

In above example, even after sorting other columns, col3 field is always R1, R2, R3, R4. How to implement this?

Also, on buttonclick, how can we uncheck all the checked boxes?


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: Is it possible to Lock sorting on one field while sorting other fields?
« Reply #1 on: October 03, 2017, 09:55:00 am »
There is no declarative support to lock sorting on one column while sorting other columns.

However this could be done by saving the column values in an array in beforeSort event and restore them back in sort event.

http://jsfiddle.net/x8dn5y87/

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Re: Is it possible to Lock sorting on one field while sorting other fields?
« Reply #2 on: October 06, 2017, 08:47:30 am »
Hi team,

I solved this issue by assigning the rowIndx num to col3.

Anyway, Sorting has 3 states - Previous Sort, Sort Ascending, Sort Descending. how to remove Previous Sort state on Sorting. I want only asc and desc sorting?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6296
    • View Profile
Re: Is it possible to Lock sorting on one field while sorting other fields?
« Reply #3 on: October 06, 2017, 10:24:04 am »
please use sortModel.cancel = false.

https://paramquery.com/pro/api#option-sortModel