Page 1 of 1

Retaining subfile sort

Posted: Tue Nov 03, 2015 4:25 pm
by kjfarison
I've created a load-all subfile so I could take advantage of the client-side sorting. It only has 1 column.

If the user changes the sort to descending, is there any way to retain the descending sort when it comes back to the RPG program? It seems that when the writes back to the browser, it always defaults to ascending order.

Re: Retaining subfile sort

Posted: Wed Nov 04, 2015 4:45 am
by Scott Klement
The sorting is only for display purposes. The data is returned to the RPG program in the same sequence it was originally written. This was done so that you could add sorting to existing programs without breaking them.

Currently, there is no way to change this behavior.

If the reason you want to do this is so that the sort sequence is retained across screen re-loads, you might consider using the 'persist state' property. This will keep the sort sequence across screen reloads (without returning the sorted sequence to your RPG program.)

Or, if it's cruicial for the data to be sorted in the RPG program (I'd be interested to hear why that would be desired) instead of letting Profound UI do the sorting, you could use the 'column sort response' property so that when someone clicks on a column heading, the column number is sent back to your RPG program, and your program can do the sorting itself using SORTA, qsort or whatever method you can imagine. Done that way, of course, the sort will be retained.

Re: Retaining subfile sort

Posted: Wed Nov 04, 2015 12:32 pm
by kjfarison
I set the "persist state" to true but it still comes back in an ascending order.

I assume this is happening because my subfile was written initially to the browser in ascending order. Is there some way for the RPG program to know that - at the time the page was submitted to the program - a column was in descending or ascending order?

Currently, I only use one "sorting-type" variable/property in the display file - "initial sort column". Could this be screwing me up?

Thanks.

Re: Retaining subfile sort

Posted: Mon Nov 09, 2015 2:37 pm
by Glenn
Kevin,

As Scott mentioned in his reply, the client-side sorting is only for display. If you need the underlying subfile to be sorted you will need to use the 'column sort response' property and sort it in the RPG program.

Glenn

Re: Retaining subfile sort

Posted: Mon Nov 09, 2015 8:05 pm
by Colin McNeill
Kevin,

We've created a support ticket regarding your issue. We'll be in contact through email!