Mike,

I tried to come up with some fix based on the "constraint" binding, but settled on this:

if (canGetValueForBinding("searchList")) list = (NSArray) valueForBinding("searchList");

in handleRequest right below getting the value for startIndex. The key to rolling it out successfully is documentation, not the super- complicated line of code above. ;-) The sortableList control is primarily concerned with reordering the objects within a specific list (or array). It does this by taking the list A, and making a new list A'. It then gets the order of the new items from the Ajax request, finds them in A, and adds them in order to A'. It then sets the binding for array A to A'. When the object x is dragged from list A to list B, array A is going to be set first. A will no longer contain x. Also, when it goes to "reorder" B, since B never contained x, it will not be able to reorder it. The solution is to allow it to search a list greater than B for x. So, like I said before, it should be the union of A and B . . . but it needs to be the union of A and B before x was removed from A. So I manually maintain an array of this union. When I add objects to A or B, I add them to the search list, and when I delete from them I delete from the search list.

I think that if I go back to looking at the "constraint" binding, and we come up with some naming convention rule, then I should be able to come up with some "automatic" way of maintaining the union. It is really cool though. The users were totally enamored.

John

On Mar 4, 2007, at 8:36 PM, Mike Schrag wrote:

Sounds cool ... Dealing with dragging between two lists was kind of tricky (as you found out :) ), so I just ignored it at the time. Is your modification a generic fix that could be rolled into Wonder?

ms

On Mar 4, 2007, at 8:31 PM, John Larson wrote:

Just as FYI, not a problem . . .

I recently finished a project management module and used the Ajax SortableList to allow users to change task priorities, etc. I also found it very useful to allow the users to organize their tasks into different statuses by dragging the task items to other lists (new, active, on-hold, completed, etc.). When an item is moved from list A to list B, the update to list A works fine, but the update to list B doesn't work because it can't find the "new" item in list B when it goes to set list B. To get around this I added a binding called "searchList" which is the union of A and B (but can be as many lists as you want). I then modified Mike's (?) code to look for searchList and use it as the source for the objects if it exists in place of the "list" binding.

Works perfect and makes the implementation really slick. (I have a style definition #completedItems > li {text-decoration:line- through;} so that the item gets crossed off when it is dropped in the completed list. ;-)

John




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons% 40mac.com

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to