Sorted list in depselect widget

A place for users and developers of the Xataface to discuss and receive support.

Sorted list in depselect widget

Postby alexchet » Wed Dec 07, 2011 10:13 am

Hi,
I use depselect widget which is populated from table hospitals

Code: Select all
[hospitalid]

widget:type = depselect
widget:table=hospitals


The table is ordered by sql request,

Code: Select all
__sql__ = "select * from hospitals ORDER BY city, hname"


but I get unsorted dropdown list in depselect widget.
Is there any way get ordered one?
alexchet
 
Posts: 5
Joined: Fri Sep 16, 2011 4:07 am

Re: Sorted list in depselect widget

Postby shannah » Wed Dec 07, 2011 10:42 am

I think you should be able to set the -sort parameter in the widget def:
Code: Select all
widget:filters:-sort="city, hname"
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Sorted list in depselect widget

Postby alexchet » Sat Dec 10, 2011 10:00 pm

To get sorted list we need to pass id - labels pairs as nonassociative array. So to solve the problem I have to edit depselect.js and depselect_load.php files.
See attachment.
Attachments
depselect.zip
extract depselect.js and depselect_load.php into its original location into depselect module directory
(5.35 KiB) Downloaded 597 times
alexchet
 
Posts: 5
Joined: Fri Sep 16, 2011 4:07 am

Re: Sorted list in depselect widget

Postby shannah » Mon Dec 12, 2011 1:59 pm

Thanks for posting this.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Sorted list in depselect widget

Postby shannah » Mon Dec 12, 2011 3:33 pm

I have added this change to the SVN trunk rev 3109.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Sorted list in depselect widget

Postby Ciao121 » Thu Jun 21, 2012 3:02 pm

If I use:
Code: Select all
[provincia_nascita]
widget:label = "Provincia di nascita"
widget:description = "Scegliere la provincia di nascita"
widget:type = depselect
widget:table=province
order = 3

I have no problem but if I add
Code: Select all
widget:filters:-sort="nomeprovincia"

I get a pop up error:
Code: Select all
SintaxError: missing; before statement

and no data in the select box.

I alredy uploaded the atthacched files on the server.
Any idea?

Thank you :)
Ciao121
 
Posts: 2
Joined: Thu Jun 21, 2012 11:02 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 17 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved