> Hi,
> I''ve been moving some of my xforms apps over to using datatables
> with sortable columns and am having problems with setting up a
> "delete" button in a data table row in that it looks as if I'm
> deleting the wrong item from the back end database.
>
> In my app I'm managing a number of network devices identified by
> their mac address
> <netdev>
> ....
> <radius_devices>
> <radius_client>
> <mac_address>dd-ee-ff-cc-aa-bb</mac_address>
> <registering_user_name>ccsas</registering_user_name>
> <date_added>2011-02-02T17:08:38.000</date_added>
> </radius_client>
> <radius_client>
> <mac_address>aa-bb-cc-dd-ee-ee</mac_address>
> <registering_user_name>ccsas</registering_user_name>
> <date_added>2011-02-02T17:20:07.000</date_added>
> </radius_client>
> ........
> </radius_devices>
> ..
> </netdev>
>
> in my view.xsl I've got
>
> ....
> <fr:datatable paginated="true" rowsPerPage="40" scrollable="both"
> width="100%" height="500px">
> <xhtml:thead>
> <xhtml:tr>
> <xhtml:th/>
> <xhtml:th fr:sortable="true"
> fr:resizeable="true">MAC Address</xhtml:th>
> <xhtml:th fr:sortable="true"
> fr:resizeable="true">When added</xhtml:th>
> <xhtml:th fr:sortable="true"
> fr:resizeable="true">Registering User</xhtml:th>
> <xhtml:th>Action</xhtml:th>
> </xhtml:tr>
> </xhtml:thead>
> <xhtml:tbody>
> <xforms:repeat nodeset="instance('netdev-instance')/
> radius_devices/radius_client" id="usersRepeat">
> <xhtml:tr>
> <xhtml:td>
> <xforms:output value="position() + ($fr-dt-
> page - 1)*40"/>
> </xhtml:td>
> <xhtml:td>
> <xforms:output ref="mac_address"/>
> </xhtml:td>
> <xhtml:td>
> <xforms:output ref="date_added"/>
> </xhtml:td>
> <xhtml:td>
> <xhtml:center>
> <xforms:output ref="registering_user_name"/>
> </xhtml:center>
> </xhtml:td>
> <xhtml:td>
> <xforms:trigger>
> <xforms:label>Remove</xforms:label>
> <xforms:action ev:event="DOMActivate">
> <xforms:setvalue
> ref="instance('status')/message" value="instance('netdev-instance')/
> radius_devices/radius_client[position() + ($fr-dt-page - 1)*40]/
> mac_address"/>
> <!-- <xforms:setvalue
> ref="instance('delete-instance')/mac_address" value="mac_address"/>
> -->
> <xforms:setvalue
> ref="instance('delete-instance')/mac_address"
> value="instance('netdev-instance')/radius_devices/
> radius_client[position() + ($fr-dt-page -1)*40]/mac_address"/>
> <xforms:send submission="delete-
> submission"/>
> </xforms:action>
> </xforms:trigger>
> </xhtml:td>
> </xhtml:tr>
> </xforms:repeat>
> </xhtml:tbody>
> </fr:datatable>
>
> When i view the page, I get a line/item count in the 1st column and
> the last column has a Remove button that should delete the entry
> from the back end database specified by the mac address. The
> "position() + ($fr-dt-page - 1)*40 " ( assuming 40 rows per page)
> statement should let me copy the correct mac address into the delete-
> instance so I can go and delete it.
>
>
> It certainly works when I've got less than 1 page of data, but what
> happens if I've got more than one page and I change the sort order
> of the table based upon one of the columns? I've got another app
> with more than 1 page full of data that I rolled the above format
> out into and I'm fairly sure that sorting the datatable contents and
> then clicking on a delete icon deleted a different item to the one I
> selected.
>
> Have I got the position() + ($fr-dt-page - 1)*40 portion right?
>
> Rgds
> Alex
>
>
>
>
>
>
>
>
> --
> You receive this message as a subscriber of the
[hidden email]
> mailing list.
> To unsubscribe: mailto:
[hidden email]
> For general help: mailto:
[hidden email]?subject=help
> OW2 mailing lists service home page:
http://www.ow2.org/wws