Hi David,

With the event mechanism, you don't need to keep reference.
Yours components keep loosely coupled.

In the onPageChanged() method you can send an event like this
send(getPage(), Broadcast.BREADTH, new YourEvent());


see the exemple: http://www.wicket-library.com/wicket-examples/events/
and at the end of this page : 
http://wicket.apache.org/2011/09/07/wicket-1.5-released.html


François Meillet
Formation Wicket - Développement Wicket





Le 11 mai 2013 à 17:37, David Beer <david.m.b...@gmail.com> a écrit :

> Hi Francois
> 
> Thanks for the reply I am not sure howfrom a reference to my table which 
> Extends DataTable I can update the button when the onPageChanged() method is 
> fired. My Table looks like the following.
> 
> AJaxTable<Contact, String> contacts = new AJaxTable<Contact, 
> String>("persons", columns, new SortableContactDataProvider(), 10) {
>            @Override
>            protected void onPageChanged() {
>                super.onPageChanged();
>                System.out.println("Page Changed");
>                //enable or disable submitButton
>            }
>        };
> 
> submitButton is initialized as follows:
> 
> submitButton = new DefaultBootstrapButton("submit-button", 
> Model.of("Submit"));
>        submitButton.add(new ButtonBehavior(Buttons.Type.Primary));
>        submitButton.setOutputMarkupId(true);
>        submitButton.setEnabled(false);
> 
> AjaxTable class looks like the following:
> 
> public class AJaxTable<T, S> extends DataTable<T, S> {
> 
>    public AJaxTable(String id, List columns, ISortableDataProvider 
> dataProvider, int rowsPerPage) {
>        super(id, columns, dataProvider, rowsPerPage);
>        setOutputMarkupId(true);
>        setVersioned(false);
>        addTopToolbar(new HeadersToolbar(this, dataProvider));
>        addBottomToolbar(new NoRecordsToolbar(this));
>        addBottomToolbar(new BootstrapNavigationToolbar(this));
>    }
> 
> }
> 
> Any help or examples are much appreciated.
> 
> Thanks
> 
> David
> 
> On 11/05/13 08:27, Francois Meillet wrote:
>> You can use the event handling mechanism.
>> 
>> 
>> François Meillet
>> Formation Wicket - Développement Wicket
>> 
>> 
>> 
>> 
>> 
>> Le 11 mai 2013 à 01:17, David Beer <david.m.b...@gmail.com> a écrit :
>> 
>>> Hi All
>>> 
>>> I have an Ajax DataTable that extends DataTable and when I click the 
>>> navigation panel to change page in the table I would like to make sure that 
>>> the necessary components are disable or enabled. What is the best way of 
>>> doing this?
>>> 
>>> So on onPageChanged I would like to enable or disable my form submit 
>>> buttons. The buttons are Ajax enabled.
>>> 
>>> Thanks
>>> 
>>> David
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

Reply via email to