Re: html_quickform_advmultiselect good news

From: Date: Mon, 27 Jun 2005 22:19:36 +0000
Subject: Re: html_quickform_advmultiselect good news
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-38340@lists.php.net to get a copy of this message
Laurent, Nice work on extending the advmultiselect code that I started and turning it into an actual PEAR package! I hadn't been keeping up with the pear-dev list and just today caught up on all the mail that was exchanged about the development of HTML_QuickForm_advmultiselect. I downloaded the package today via pear and tried it out in an application I am working on and it appears to work great. Suggestions: *Sorting of select lists* It would be nice to have an option for the select lists to sort alphabetically when elements are moved between them. It is confusing when the list starts out sorted and then when you move an option back and forth between select lists it always gets added to the bottom. Of course, not everything makes sense to be sorted alphabetically but I'd guess that having that as the default option would work for the majority of cases and people can disable it if they don't want the sorting (or replace it with some other sorting routine that matches the data in the select). To implement this would require adding javascript code that gets run whenever the elements move between select boxes. I propose adding a member variable to the class titled something like $_jsSortFunction that would contain javascript code to be used for the sorting routine. The code in $this->_jsSortFunction would be inserted at the end of the javascript code generated in getElementJs(). Don't want sorting? Just make sure $this->_jsSort is an empty string. I think that would work, but it's possible that you'd actually need two new variables - one to contain the name of the function to call and a second to actually contain the javascript of the function. In any case the PHP side of it is easy. I took a shot at the javascript code as a proof-of-concept type thing (and because I wouldn't be surprised if someone can make the javascript code better). I didn't change any of the actual PHP code yet that would be needed for this to be a workable solution in PEAR. You can see the code and a demo at: http://jalessio.com/pear/ - Jamie

« previous php.pear.dev (#38340) next »