SearchPane - Ordering inside a Column
SearchPane - Ordering inside a Column
I have created a table with sports activities for disabled people. Users can search for offers. The "SearchPane" extension is also set up for this purpose. In one SearchPane-column you can filter by days of the week. I would like to sort this column in the order of the days of the week (Mo, Di, Mi, Do, Fr, Sa, So). Is there any way to do this?
I have found the possibility to order by count or by title, asc and desc. Is there any other way to order the entries?
You can find the table here: https://bsberlin.de/switch/angebote-breitensport
Thanks Hubert
Answers
Hi @hkuesters ,
Yes this is possible, you are best to use the "datetime-moment" plugin for this. I've put together a quick example for you here.
I also notice on your page that you are indicating to your users to hold shift to make multiple selections. This is fine, but if you feel it would be cleaner for your use case, you could set
select.style
tomulti
insearchPanes.dtOpts
to allow for multiple selections without holding shift or control. It was raised recently in this forum post.Hope this helps,
Sandy
Hi @Sandy!
Many thanks for your response!
Now it's working!
There were two more hurdles I had to overcome.
1.
In order to be able to use the german version / sorting, the file "//momentjs.com/downloads/moment-with-locales.js" is required. The call is then made as follows:
$ .fn.dataTable.moment ('dd', 'de');
'dd' for the format of the days of the week
'de' for localization
2. This hurdle was pretty sneaky. I had a few entries in the form of "-" in the column "day of the week" in my data records. JavaScript cannot handle this. They have to be removed and replaced by empty entries. Then it works.
Thanks also for the note on multiple selection!
Hubert