cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Fiol Bonnín <antonio.f...@gmail.com>
Subject move-up and move-down not working
Date Mon, 27 Jun 2005 08:24:46 GMT
Hello,

I am using a repeater with move-up and move-down row-action buttons.

Adding, deleting, and modifying works perfectly. move-up and move-down do 
not work.

Can anyone help me track the problem down?

Note: The "componentes" empty element is filled with "persona" elements by 
another form. The other elements on the empty "grupo" template are mapped to 
the fields I removed for simplicity.

Thank you very much.

-- 
Antonio


-------------------
definition:
<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" xmlns:xi="
http://www.w3.org/2001/XInclude">

<fd:widgets>
<fd:repeater id="grupos">
<fd:widgets>
<fd:output id="id">
<fd:datatype base="long" />
</fd:output>
<fd:field id="nombre" required="true">
<fd:label>Nombre</fd:label>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="2" />
</fd:validation>
</fd:field>
<!-- Several other fields -->
<fd:booleanfield id="select">
<fd:label>Sel.</fd:label>
</fd:booleanfield>
<fd:row-action id="subir" action-command="move-up">
<fd:label>Subir</fd:label>
</fd:row-action>
<fd:row-action id="bajar" action-command="move-down">
<fd:label>Bajar</fd:label>
</fd:row-action>

</fd:widgets>
</fd:repeater>
<fd:repeater-action id="addgrupo" action-command="add-row" 
repeater="grupos">
<fd:label>Añadir grupo</fd:label>
</fd:repeater-action>
<fd:repeater-action id="delgrupo" action-command="delete-rows" 
repeater="grupos" select="select">
<fd:label>Eliminar grupos seleccionadas</fd:label>
</fd:repeater-action>
</fd:widgets>
</fd:form>

-------------------------
binding:
<fb:context
xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
path="/" >

<fb:repeater id="grupos"
parent-path="grupos"
row-path="grupo">

<fb:identity>
<fb:value id="id" path="@id">
<fd:convertor datatype="long" />
</fb:value>
</fb:identity>

<fb:on-bind>
<fb:value id="id" path="@id" direction="load">
<fd:convertor datatype="long" />
</fb:value>
<fb:javascript id="id" path="@id" direction="save">
<fb:save-form>
var formValue = widget.getValue();
if(formValue > 0) {
jxpathPointer.setValue(formValue);
} else {
jxpathPointer.setValue(new Packages.java.lang.Long(
Packages.java.lang.System.currentTimeMillis()).toString());
Packages.java.lang.Thread.sleep(5); // Garantiza que 
System.currentTimeMillis() sea único.
}
</fb:save-form>
</fb:javascript>
<fb:value id="nombre" path="datos/nombre" />
<!-- Other fb:value for other fields -->
</fb:on-bind>

<fb:on-delete-row>
<fb:delete-node />
</fb:on-delete-row>
<fb:on-insert-row>
<fb:insert-node>
<grupo id="">
<datos>
<nombre/>
<tipo/>
<padre id=""/>
<descripcion/>
<plantas/>
<extension/>
<telefonoDirecto/>
<fax/>
</datos>
<componentes/>
</grupo>
</fb:insert-node>
</fb:on-insert-row>
</fb:repeater>
</fb:context>


----------------
flow:
function grupos(form) {
var datos = leerDatos("xml/forms/datos/grupos.xml");

form.load(datos);
form.showForm("grupos-form-display-pipeline");
form.save(datos);

grabarDatos("xml/forms/datos/grupos.xml", "xml/forms/datos/grupos.xml.tmp", 
datos);
cocoon.sendPage("grupos-form-success-pipeline");
}

grabarDatos is a function streaming the XML to a tmp file and then moving it 
on success to the real file.
leerDatos reads the XML file into a DOM.

Mime
View raw message