Re: Strange behaviour of AjaxSortableList
Re: Strange behaviour of AjaxSortableList
- Subject: Re: Strange behaviour of AjaxSortableList
- From: Helmut Schottmüller <email@hidden>
- Date: Tue, 15 Apr 2008 13:44:17 +0200
Ok,
the problem seems to be the onUpdate binding.
The AjaxSortableList generates code like:
... ; var parentOnUpdate = parentOnUpdate(container); ...
If you set the onUpdate binding (e.g. with 'updateContainerUpdate()')
it generates
...; var parentOnUpdate = updateContainerUpdate();
parentOnUpdate(container); ...
which makes parentOnUpdate a function which is not known in the actual
window context.
It pretty seems that var parentOnUpdate = parentOnUpdate(container);
doesn't make any sense at all. Debugging with Firebug gives me a
catched exception because parenOnUpdate() is not a function...
The code in AjaxSortableList.java to create the JS code is:
StringBuffer onUpdateBuffer = new StringBuffer();
onUpdateBuffer.append("function(container) {");
// onComplete:ajaxResponse
String containerID = (String) valueForBinding("id");
onUpdateBuffer.append("var data = Sortable.serialize('" +
containerID + "', { name:'" + _sortOrderKeyName + "'});");
onUpdateBuffer.append("var ajaxRequest = new Ajax.Request('" +
_actionUrl + "', {method: 'get', parameters: data});");
if (canGetValueForBinding("onUpdate")) {
String onUpdate = (String) valueForBinding("onUpdate");
onUpdateBuffer.append(" var parentOnUpdate = ");
onUpdateBuffer.append(onUpdate);
onUpdateBuffer.append(";");
onUpdateBuffer.append("parentOnUpdate(container);");
}
onUpdateBuffer.append("}");
return onUpdateBuffer.toString();
When I replace this with:
StringBuffer onUpdateBuffer = new StringBuffer();
onUpdateBuffer.append("function(container) {");
// onComplete:ajaxResponse
String containerID = (String) valueForBinding("id");
onUpdateBuffer.append("var data = Sortable.serialize('" +
containerID + "', { name:'" + _sortOrderKeyName + "'});");
onUpdateBuffer.append("var ajaxRequest = new Ajax.Request('" +
_actionUrl + "', {method: 'get', parameters: data});");
if (canGetValueForBinding("onUpdate")) {
String onUpdate = (String) valueForBinding("onUpdate");
if ((onUpdate != null) && (onUpdate.length() > 0))
{
onUpdateBuffer.append(onUpdate);
onUpdateBuffer.append(";");
}
}
else
{
onUpdateBuffer.append(" var parentOnUpdate = ");
onUpdateBuffer.append("parentOnUpdate(container);");
}
it works fine for me. But since I don't know what
parentOnUpdate(container) does, it might not be the perfect solution.
@Mike: I think this is your code. Do you have any hints for me?
Regards,
Helmut
Am 15.04.2008 um 12:20 schrieb Helmut Schottmüller:
Hi Daniele,
Am 15.04.2008 um 12:13 schrieb Daniele Corti:
Well, I think you should consider a way different of Sortablelist
to reorder the list... try something like arrow up and down and
textfield with the order (in Joomla Style if you know it).
Or you can do two pages, one for reorder and one for delete add
modify
yes I could do that but it you have to move an item from the bottom
of the list to the top of the list by clicking 20 times I doubt this
is a very convenient solution :-)
Maybe the SortableList isn't meant for such a functionality... or
maybe I am just too stupid to use it.
Regards,
Helmut _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden