wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nino martinez wael <nino.martinez.w...@gmail.com>
Subject AbstractToolbar vs AjaxFallbackDefaultDataTable
Date Thu, 29 Dec 2016 08:37:26 GMT
Hi

I am having a little trouble, making my own toolbar. Currently on
pagination change my toolbar are added, but the old toolbar are not removed
/ updated. So for every click on pagination, additional toolbars are added.

Short story:
User clicks page 2 on AjaxFallbackDefaultDataTable
User now sees two delete buttons

public abstract class SelectedListActionToolbar extends AbstractToolbar {

    public SelectedListActionToolbar(final IModel<HashMap<Integer, Site>>
model, final DataTable<?, ?> table)
    {
        super(table);
        setOutputMarkupId(true);
        Link link=new Link("onAction"){
            @Override
            public void onClick() {
                SelectedListActionToolbar.this.onClick(model);
            }
        };
        add(link);


    }

    public abstract void onClick(final IModel<HashMap<Integer, Site>>
model);


<wicket:panel>
    <button wicket:id="onAction" type="button" class="btn
btn-danger">Delete Selected</button>

</wicket:panel>


        AjaxFallbackDefaultDataTable dataTable = getTable();
        dataTable.addBottomToolbar(new
SelectedListActionToolbar(selectedSites,dataTable) {
            @Override
            public void onClick(final IModel<HashMap<Integer, Site>> model)
{
                //Delete the stuff!
            }
        });

        add(dataTable);


-- 
Best regards / Med venlig hilsen
Nino Martinez

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message