Roundcube Community Forum

 

trying to sort the messagelist

Started by mats, November 09, 2024, 11:04:10 AM

Previous topic - Next topic

mats

I'm tryin to sort the messagelist from code and so far I have got it to almost work
return rcmail.command('sort','arrival'); will sort the list but it will toggle the sort order everytime it's run.

I would like to do something like return rcmail.command('sort','arrival','ASC'); but that dosen't work. Looking into list.php it seems doable

Running on 1.6.9 and elastic

SKaero

I'm not sure why you would want to sort the mail list if its already sorted but here is the code for the sort command: https://github.com/roundcube/roundcubemail/blob/release-1.6/program/js/app.js#L894-L906

It looks at rcmail.env.sort_order value for the order and then flips it so you could set it to "DESC" and then run the sort command and it would sort "ASC".

I think it may make more sense to just make a call to rcmail.list_mailbox to reload the message list depending on what your trying to do.

mats

Quote from: SKaero on November 09, 2024, 12:53:41 PMI'm not sure why you would want to sort the mail list if its already sorted but here is the code for the sort command: https://github.com/roundcube/roundcubemail/blob/release-1.6/program/js/app.js#L894-L906

It looks at rcmail.env.sort_order value for the order and then flips it so you could set it to "DESC" and then run the sort command and it would sort "ASC".


Thanks. That works

I'm trying to replace the list options popup with some more modern controls so I do need to be able to re-sort the messagelist based on what's selected in my new dropdown

Quote from: SKaero on November 09, 2024, 12:53:41 PMI think it may make more sense to just make a call to rcmail.list_mailbox to reload the message list depending on what your trying to do.

Possibly - I'm on the try and see what works level .....

mats

had to use rcmail.list_mailbox plus rcmail.env.sort_order and rcmail.env.sort_col to get the behavior I wanted. rcmail.command('sort',sortcolumn) gave some interesting issues when leaving subject.

To bad I couldn't insert an image and show how it looks