Hi Chris,

As I told you earlier (but it seems it was in another post), in our case we
need to retrieve the item's data-hash for retrieving and deleting the
correct item
So the code becomes:

item.add(new AjaxLink<Void>("remove") {

    private static final long serialVersionUID = 1L;

    @Override
    protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
    {
        super.updateAjaxAttributes(attributes);

        attributes.getDynamicExtraParameters().add("return { hash:
jQuery(attrs.event.target).parent('li').data('hash') }");
    }

    @Override
    public void onClick(AjaxRequestTarget target)
    {
        int hashCode =
RequestCycleUtils.getQueryParameterValue("hash").toInt();
        String removedItem = list.get(ListUtils.indexOf(hashCode, list));

        MySortable.this.onRemove(target, removedItem);
        MySortable.this.info("removed " + removedItem);

        target.add(MySortable.this);
        target.add(feedback);
    }
});

Best regards,
Sebastien


On Sun, Feb 8, 2015 at 6:10 PM, Sebastien <[email protected]> wrote:

> Damned, I sent the mail a little bit to quickly... the button does not
> remove the correct item if it has moved... Will fix that.
>
>

Reply via email to