Re: how to implement a Form with Ajax Paginated List of Checkboxes?

2011-12-06 Thread heapifyman
Hi,

I have the same problem and I would appreciate if you could post a code
example of how you solved your problem? Specifically what you put into
the AjaxCheckBox' onUpdate() method?

Thanks


2011/8/11 bad boy badmas...@yahoo.com

 AjaxFormChoiceComponentUpdatingBehavior did not work. For some reason ir
 would only ccept the first checkbox.  when I checked  say 5 checkboxe, it
 would only remember the first fone


 But changing Check to AjaxCheckBox worked perfectly.


 Thanks





 - Original Message -
 From: Martin Grigorov mgrigo...@apache.org
 To: users@wicket.apache.org; bad boy badmas...@yahoo.com
 Cc:
 Sent: Wednesday, August 10, 2011 7:35 AM
 Subject: Re: how to implement a Form with Ajax Paginated List of
 Checkboxes?

 Add AjaxFormChoiceComponentUpdatingBehavior to the CheckGroup

 On Wed, Aug 10, 2011 at 4:38 AM, bad boy badmas...@yahoo.com wrote:
  On my Wicket page, I have a form with a couple of TextFields and a
 paginated List of Checkboxes implemented with Dataview and and a sortable
 data provider.  The ajax pagination of the dataview works fine.
 
  The problem is that when I select a few items on Page 1 and then go to
 Page 2 and then return to Page 1 using the AjaxPagingNavigator, the
 selection is lost : the items that were checked on Page 1 initially do no
 have the check mark anymore.
 
  What should I do so that the items that were selected on a page of
 Dataview do not get lost when the AjaxPagnigaion is used to traverse the
 pages of the Dataview ?
 
 
 
  public final class AjaxFormWithPaginatedCheckBoxPage extends BasePage {
 
  static Logger logger =
 Logger.getLogger(AjaxFormWithPaginatedCheckBoxPage.class);
  private Person person = new Person();
  int counter = 0;
 
  WebMarkupContainer webMC;
  static ListPerson pList=Person.getPersons(100);
  int maxListCount=5;
  DataView dv;
  CheckGroup group;
  public AjaxFormWithPaginatedCheckBoxPage() {
  super();
  final Form form = new Form(form, new
 CompoundPropertyModel(person)) {
 
  protected void onSubmit() {
  logger.info(form recived);
  logger.info( person name  + person.getName());
 
  setResponsePage(new AjaxTogglePanelTestPage());
  }
  };
  final TextField name = new TextField(name);
  final TextField age = new TextField(age);
  form.add(name);
  form.add(age);
 
 
  group=new CheckGroup(group, new ArrayList());
  form.add(group);
 
  webMC= new WebMarkupContainer(webMC);
  webMC.setOutputMarkupId(true);
 
 
  SortablePersonDataProvider personDataProvider=new
 SortablePersonDataProvider(pList);
  dv = new DataViewPerson(persons, personDataProvider) {
 
  @Override
  protected void populateItem(ItemPerson item) {
  item.add(new Check(check, item.getModel()));
 
  item.add(new Label(id, new PropertyModel(item.getModel(),
 id)));
  item.add(new Label(name, new
 PropertyModel(item.getModel(), name)));
  item.add(new Label(age, new PropertyModel(item.getModel(),
 age)));
  }
 
 
  };
  dv.setItemsPerPage(maxListCount);
 
 
  webMC.add(new AjaxFallbackOrderByBorder(orderByID, id,
 personDataProvider)
  {
  @Override
  protected void onSortChanged()
  {
  dv.setCurrentPage(0);
  }
 
  @Override
  protected void onAjaxClick(AjaxRequestTarget target) {
  target.addComponent(webMC);
  }
  });
 
  webMC.add(new AjaxFallbackOrderByBorder(orderByName, name,
 personDataProvider)
  {
  @Override
  protected void onSortChanged()
  {
  dv.setCurrentPage(0);
  }
 
  @Override
  protected void onAjaxClick(AjaxRequestTarget target) {
  target.addComponent(webMC);
  }
  });
  webMC.add(new AjaxFallbackOrderByBorder(orderByAge, age,
 personDataProvider)
  {
  @Override
  protected void onSortChanged()
  {
  dv.setCurrentPage(0);
  }
 
  @Override
  protected void onAjaxClick(AjaxRequestTarget target) {
  target.addComponent(webMC);
  }
  });
 
 
  webMC.add(dv);
  webMC.add(new AjaxPagingNavigator(navigator,dv));
  group.add(webMC);
 
  AjaxButton ab = new AjaxButton(ajax-button, new
 PropertyModelString(this,
  counter), form) {
 
  @Override
  protected void onSubmit(AjaxRequestTarget target, Form? form) {
  counter++;
  logger.info(ajx form recived);
  logger.info(ajx person name  + person.getName());
 
  target.addComponent(this);
 
  }
  };
  form.add(ab);
  form.setDefaultButton(ab);
 
  add(form);
  }
  }
 
  Thanks
  Badmash
 
  -
  To unsubscribe, e-mail: 

Re: how to implement a Form with Ajax Paginated List of Checkboxes?

2011-08-10 Thread Martin Grigorov
Add AjaxFormChoiceComponentUpdatingBehavior to the CheckGroup

On Wed, Aug 10, 2011 at 4:38 AM, bad boy badmas...@yahoo.com wrote:
 On my Wicket page, I have a form with a couple of TextFields and a paginated 
 List of Checkboxes implemented with Dataview and and a sortable data 
 provider.  The ajax pagination of the dataview works fine.

 The problem is that when I select a few items on Page 1 and then go to Page 2 
 and then return to Page 1 using the AjaxPagingNavigator, the selection is 
 lost : the items that were checked on Page 1 initially do no have the check 
 mark anymore.

 What should I do so that the items that were selected on a page of Dataview 
 do not get lost when the AjaxPagnigaion is used to traverse the pages of the 
 Dataview ?



 public final class AjaxFormWithPaginatedCheckBoxPage extends BasePage {

 static Logger logger = 
 Logger.getLogger(AjaxFormWithPaginatedCheckBoxPage.class);
 private Person person = new Person();
 int counter = 0;

 WebMarkupContainer webMC;
 static ListPerson pList=Person.getPersons(100);
 int maxListCount=5;
 DataView dv;
 CheckGroup group;
 public AjaxFormWithPaginatedCheckBoxPage() {
     super();
     final Form form = new Form(form, new CompoundPropertyModel(person)) {

         protected void onSubmit() {
             logger.info(form recived);
             logger.info( person name  + person.getName());

             setResponsePage(new AjaxTogglePanelTestPage());
         }
     };
     final TextField name = new TextField(name);
     final TextField age = new TextField(age);
     form.add(name);
     form.add(age);


     group=new CheckGroup(group, new ArrayList());
     form.add(group);

     webMC= new WebMarkupContainer(webMC);
     webMC.setOutputMarkupId(true);


     SortablePersonDataProvider personDataProvider=new 
 SortablePersonDataProvider(pList);
     dv = new DataViewPerson(persons, personDataProvider) {

         @Override
         protected void populateItem(ItemPerson item) {
             item.add(new Check(check, item.getModel()));

             item.add(new Label(id, new PropertyModel(item.getModel(), 
 id)));
             item.add(new Label(name, new PropertyModel(item.getModel(), 
 name)));
             item.add(new Label(age, new PropertyModel(item.getModel(), 
 age)));
         }


     };
     dv.setItemsPerPage(maxListCount);


     webMC.add(new AjaxFallbackOrderByBorder(orderByID, id, 
 personDataProvider)
     {
         @Override
         protected void onSortChanged()
         {
             dv.setCurrentPage(0);
         }

         @Override
         protected void onAjaxClick(AjaxRequestTarget target) {
             target.addComponent(webMC);
         }
     });

     webMC.add(new AjaxFallbackOrderByBorder(orderByName, name, 
 personDataProvider)
     {
         @Override
         protected void onSortChanged()
         {
             dv.setCurrentPage(0);
         }

         @Override
         protected void onAjaxClick(AjaxRequestTarget target) {
             target.addComponent(webMC);
         }
     });
     webMC.add(new AjaxFallbackOrderByBorder(orderByAge, age, 
 personDataProvider)
     {
         @Override
         protected void onSortChanged()
         {
             dv.setCurrentPage(0);
         }

         @Override
         protected void onAjaxClick(AjaxRequestTarget target) {
             target.addComponent(webMC);
         }
     });


     webMC.add(dv);
     webMC.add(new AjaxPagingNavigator(navigator,dv));
     group.add(webMC);

     AjaxButton ab = new AjaxButton(ajax-button, new 
 PropertyModelString(this,
             counter), form) {

         @Override
         protected void onSubmit(AjaxRequestTarget target, Form? form) {
             counter++;
             logger.info(ajx form recived);
             logger.info(ajx person name  + person.getName());

             target.addComponent(this);

         }
     };
     form.add(ab);
     form.setDefaultButton(ab);

     add(form);
 }
 }

 Thanks
 Badmash

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to implement a Form with Ajax Paginated List of Checkboxes?

2011-08-10 Thread bad boy
AjaxFormChoiceComponentUpdatingBehavior did not work. For some reason ir would 
only ccept the first checkbox.  when I checked  say 5 checkboxe, it would only 
remember the first fone


But changing Check to AjaxCheckBox worked perfectly.


Thanks





- Original Message -
From: Martin Grigorov mgrigo...@apache.org
To: users@wicket.apache.org; bad boy badmas...@yahoo.com
Cc: 
Sent: Wednesday, August 10, 2011 7:35 AM
Subject: Re: how to implement a Form with Ajax Paginated List of Checkboxes?

Add AjaxFormChoiceComponentUpdatingBehavior to the CheckGroup

On Wed, Aug 10, 2011 at 4:38 AM, bad boy badmas...@yahoo.com wrote:
 On my Wicket page, I have a form with a couple of TextFields and a paginated 
 List of Checkboxes implemented with Dataview and and a sortable data 
 provider.  The ajax pagination of the dataview works fine.

 The problem is that when I select a few items on Page 1 and then go to Page 2 
 and then return to Page 1 using the AjaxPagingNavigator, the selection is 
 lost : the items that were checked on Page 1 initially do no have the check 
 mark anymore.

 What should I do so that the items that were selected on a page of Dataview 
 do not get lost when the AjaxPagnigaion is used to traverse the pages of the 
 Dataview ?



 public final class AjaxFormWithPaginatedCheckBoxPage extends BasePage {

 static Logger logger = 
 Logger.getLogger(AjaxFormWithPaginatedCheckBoxPage.class);
 private Person person = new Person();
 int counter = 0;

 WebMarkupContainer webMC;
 static ListPerson pList=Person.getPersons(100);
 int maxListCount=5;
 DataView dv;
 CheckGroup group;
 public AjaxFormWithPaginatedCheckBoxPage() {
     super();
     final Form form = new Form(form, new CompoundPropertyModel(person)) {

         protected void onSubmit() {
             logger.info(form recived);
             logger.info( person name  + person.getName());

             setResponsePage(new AjaxTogglePanelTestPage());
         }
     };
     final TextField name = new TextField(name);
     final TextField age = new TextField(age);
     form.add(name);
     form.add(age);


     group=new CheckGroup(group, new ArrayList());
     form.add(group);

     webMC= new WebMarkupContainer(webMC);
     webMC.setOutputMarkupId(true);


     SortablePersonDataProvider personDataProvider=new 
 SortablePersonDataProvider(pList);
     dv = new DataViewPerson(persons, personDataProvider) {

         @Override
         protected void populateItem(ItemPerson item) {
             item.add(new Check(check, item.getModel()));

             item.add(new Label(id, new PropertyModel(item.getModel(), 
 id)));
             item.add(new Label(name, new PropertyModel(item.getModel(), 
 name)));
             item.add(new Label(age, new PropertyModel(item.getModel(), 
 age)));
         }


     };
     dv.setItemsPerPage(maxListCount);


     webMC.add(new AjaxFallbackOrderByBorder(orderByID, id, 
 personDataProvider)
     {
         @Override
         protected void onSortChanged()
         {
             dv.setCurrentPage(0);
         }

         @Override
         protected void onAjaxClick(AjaxRequestTarget target) {
             target.addComponent(webMC);
         }
     });

     webMC.add(new AjaxFallbackOrderByBorder(orderByName, name, 
 personDataProvider)
     {
         @Override
         protected void onSortChanged()
         {
             dv.setCurrentPage(0);
         }

         @Override
         protected void onAjaxClick(AjaxRequestTarget target) {
             target.addComponent(webMC);
         }
     });
     webMC.add(new AjaxFallbackOrderByBorder(orderByAge, age, 
 personDataProvider)
     {
         @Override
         protected void onSortChanged()
         {
             dv.setCurrentPage(0);
         }

         @Override
         protected void onAjaxClick(AjaxRequestTarget target) {
             target.addComponent(webMC);
         }
     });


     webMC.add(dv);
     webMC.add(new AjaxPagingNavigator(navigator,dv));
     group.add(webMC);

     AjaxButton ab = new AjaxButton(ajax-button, new 
 PropertyModelString(this,
             counter), form) {

         @Override
         protected void onSubmit(AjaxRequestTarget target, Form? form) {
             counter++;
             logger.info(ajx form recived);
             logger.info(ajx person name  + person.getName());

             target.addComponent(this);

         }
     };
     form.add(ab);
     form.setDefaultButton(ab);

     add(form);
 }
 }

 Thanks
 Badmash

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


how to implement a Form with Ajax Paginated List of Checkboxes?

2011-08-09 Thread bad boy
On my Wicket page, I have a form with a couple of TextFields and a paginated 
List of Checkboxes implemented with Dataview and and a sortable data provider.  
The ajax pagination of the dataview works fine.

The problem is that when I select a few items on Page 1 and then go to Page 2 
and then return to Page 1 using the AjaxPagingNavigator, the selection is lost 
: the items that were checked on Page 1 initially do no have the check mark 
anymore. 

What should I do so that the items that were selected on a page of Dataview do 
not get lost when the AjaxPagnigaion is used to traverse the pages of the 
Dataview ?



public final class AjaxFormWithPaginatedCheckBoxPage extends BasePage {

static Logger logger = 
Logger.getLogger(AjaxFormWithPaginatedCheckBoxPage.class);
private Person person = new Person();
int counter = 0;

WebMarkupContainer webMC;
static ListPerson pList=Person.getPersons(100); 
int maxListCount=5;
DataView dv;
CheckGroup group;
public AjaxFormWithPaginatedCheckBoxPage() {
    super();
    final Form form = new Form(form, new CompoundPropertyModel(person)) {

        protected void onSubmit() {
            logger.info(form recived);
            logger.info( person name  + person.getName());

            setResponsePage(new AjaxTogglePanelTestPage());
        }
    };
    final TextField name = new TextField(name);
    final TextField age = new TextField(age);
    form.add(name);
    form.add(age);


    group=new CheckGroup(group, new ArrayList());        
    form.add(group);

    webMC= new WebMarkupContainer(webMC);
    webMC.setOutputMarkupId(true);


    SortablePersonDataProvider personDataProvider=new 
SortablePersonDataProvider(pList);
    dv = new DataViewPerson(persons, personDataProvider) {

        @Override
        protected void populateItem(ItemPerson item) {
            item.add(new Check(check, item.getModel()));

            item.add(new Label(id, new PropertyModel(item.getModel(), 
id)));                
            item.add(new Label(name, new PropertyModel(item.getModel(), 
name)));                
            item.add(new Label(age, new PropertyModel(item.getModel(), 
age)));                
        }


    };
    dv.setItemsPerPage(maxListCount);


    webMC.add(new AjaxFallbackOrderByBorder(orderByID, id, 
personDataProvider)
    {
        @Override
        protected void onSortChanged()
        {
            dv.setCurrentPage(0);
        }

        @Override
        protected void onAjaxClick(AjaxRequestTarget target) {
            target.addComponent(webMC);
        }
    });

    webMC.add(new AjaxFallbackOrderByBorder(orderByName, name, 
personDataProvider)
    {
        @Override
        protected void onSortChanged()
        {
            dv.setCurrentPage(0);
        }

        @Override
        protected void onAjaxClick(AjaxRequestTarget target) {
            target.addComponent(webMC);
        }
    });
    webMC.add(new AjaxFallbackOrderByBorder(orderByAge, age, 
personDataProvider)
    {
        @Override
        protected void onSortChanged()
        {
            dv.setCurrentPage(0);
        }

        @Override
        protected void onAjaxClick(AjaxRequestTarget target) {
            target.addComponent(webMC);
        }
    });


    webMC.add(dv);        
    webMC.add(new AjaxPagingNavigator(navigator,dv));
    group.add(webMC);

    AjaxButton ab = new AjaxButton(ajax-button, new 
PropertyModelString(this,
            counter), form) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form? form) {
            counter++;
            logger.info(ajx form recived);
            logger.info(ajx person name  + person.getName());

            target.addComponent(this);

        }
    };
    form.add(ab);
    form.setDefaultButton(ab);

    add(form);        
}
}

Thanks
Badmash

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org