CFFORM has a cool sample of a slush control, basically two selects where you can send items to the left and right. This was designed by Ron Pasch from Prisma-IT. I took his code and packaged it up into a nice little custom tag. You can now have this control on your form without any modification to your cfform tag. You simply add:
<cf_slush name="users" query="#data#" valuecol="id" displaycol="name" colwidth="150" size="5" selected="3">
You can download this code here. (I'll be adding it to My Tools in a few minutes.)


Comment 1 written by Rob Brooks-Bilson on 30 March 2005, at 11:03 AM
Comment 2 written by Roland Collins on 30 March 2005, at 1:58 PM
Comment 3 written by Raymond Camden on 30 March 2005, at 2:05 PM
Roland: The intent of this tag, at least in my opinion, is to allow for the selection of multiple items. Therefore, order is not relevant.
Comment 4 written by Roland Collins on 30 March 2005, at 2:59 PM
We use these all over the place with a very large user base, and our original version did not take order into account - our users were very quick to point out this fault. Maintaining the order has become the expected behavior, and it really doesn't make any sense to reverse the order anyway!
Anyway, check your email - I sent you a fixed version that maintains the order.
Comment 5 written by pim on 22 April 2005, at 3:52 AM
I did it based on some Flex examples, but I haven't come out with a good implementation idea :(
You can see it there : http://cfpim.coffeeflower.com/treeDragAndDrop/
In flash 2004 components, there is something called delataPacket, which is an XML that holds what's been inserted, deleted, updated in a dataset, it would great to have such feature in the CF flash components.
Cheers
Comment 6 written by Raymond Camden on 22 April 2005, at 10:14 AM
Comment 7 written by pim on 25 April 2005, at 7:39 AM
Using selectMode=edit allows you to change values in the datagrid and get the changes in the posted values, but it won't track added or removed records. Maybe a cfgridupdate could catch those changes, but I don't see a good use for it. Maybe in a future version of adobe coldfusion ;)
Comment 8 written by Raymond Camden on 25 April 2005, at 9:20 AM
Comment 9 written by pim on 25 April 2005, at 11:50 AM
Try inserting a new row in Grid1 and dragging it in Grid2, the posted form will say that you have inserted a row in Grid1.
It just doesn't see anything from the drag operations. I think it is well handled in Flex, but CF has not been designed for it :(
I have tried triggering all kind of events, I have let them commented in the code. I will ask Mike Nimer if he has an idea ;)
Comment 10 written by Raymond Camden on 25 April 2005, at 11:52 AM
Comment 11 written by Raymond Camden on 25 April 2005, at 11:52 AM
Comment 12 written by Ron Pasch on 1 May 2005, at 10:33 PM
I see raymond and some others have picked it up, expanded it and made it into a nice custom tag :-) Good job!
Comment 13 written by Roger Chew on 18 January 2006, at 1:58 PM
There is a 1 to 1 relationship btw the display column and the firstname. I have firstname and lastname in 2 separate database tables. Therefore, how would I be able to have the firstname AND lastname displayed in the one display column?
thanks.
roger
Comment 14 written by Raymond Camden on 18 January 2006, at 5:13 PM
Comment 15 written by Roger Chew on 18 January 2006, at 5:46 PM
Here is my query:
select id, firstname + ' ' + lastname as name from member
roger
Comment 16 written by Roger Chew on 19 January 2006, at 5:23 PM
So I modified slushy just a bit so that it would accept 2 queries. One query to populate data for the left column and another query to populate data for the right column.
Im creating a slushy form for a student/teacher application. In this slushy, the teacher would be able to see a list of all students in the left column. The right column would contain a list of students currently enrolled in the class.
I would like it so that the teacher would be able to add and/or remove students from the class. The problem is how to capture that change. So for example, the teacher removes the student Joe and adds the student Jane. How do I capture that Joe needs to be removed and Jane needs to be added to the class after the teacher clicks on the submit button? Do I need to do some comparison with the original current list of students and the new current list of students? Or do I need to capture in real time a list of students that need to be removed and a list of students that need to be added?
thanks,
roger
Comment 17 written by Raymond Camden on 20 January 2006, at 1:46 PM
Comment 18 written by Jeff Bouley on 23 March 2006, at 8:55 AM
I really like your drag drop and see where it is not populating the target grid. I am able to do an addItem for the target grid via the selectedItem property of the source grid. As long as your gridcolumn names match up you're golden. An addItem... one line of code, good stuff. Not sure if I'm missing something here, but to get around the submit issues you are having I suggest remoting and relocating the browser via a _root.loader_mc.getURL("your targetURL", "_self","GET"); after successful remote to submit the form.
Comment 19 written by Peter Tanswell on 6 July 2006, at 5:37 AM
A couple of questions.
What do I need to do to allow the elft hand column to show names that are currently stored in a database table.
The second column on the right will also be a table in the database. It may or maynot have names in the table. How do I show these names in the column as well.
Also when I click submit I guess what I want to do is use the top data area and have it so a user can enter a day & date in that field. Then I will creat a table in the database for day and date and then with the names in the right hand column. These will be the people who are rostered on duty for a particular day.
Thanks in advance.
Comment 20 written by Ryan on 14 August 2009, at 8:50 AM
Comment 21 written by Raymond Camden on 14 August 2009, at 9:15 AM
[Add Comment] [Subscribe to Comments]