You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tim Lantry <tl...@gmail.com> on 2007/08/30 15:39:12 UTC

CheckGroup in a DataTable

I am using a Check component inside of a DataTable.  The DataTable is
surrounded by a CheckGroup.  The model on each Check component is the Row
Model.  This works great to get a list of checked rows.

Is there a good way to retain the checks across pages?

I created a new Navigator component that uses SubmitLinks instead of the
Link component, but he List of models doesn't retain the objects from the
previous page.

Any suggestions?

Re: CheckGroup in a DataTable

Posted by Tim Lantry <tl...@gmail.com>.
Good point.  I'll have to think about that one.

On 8/31/07, Igor Vaynberg <ig...@gmail.com> wrote:
>
> then the problem is that previously checked but now unchecked things wont
> be
> cleared from your collection....
>
> -igor
>
> On 8/31/07, Tim Lantry <tl...@gmail.com> wrote:
> >
> > Ok.  I noticed in the updateModel method of the CheckGroup it is
> clearing
> > the collection each time before adding the new ones to avoid duplicates
> in
> > the collection.
> > So I created a new component that extends the CheckGroup and changed the
> > updateModel method.  I removed the collection.clear() and instead of
> > adding
> > all the items, I check to make sure they don't already exist.  Now it
> > holds
> > those checks across pages.
> >
> > public void updateModel()
> >     {
> >         Collection collection = (Collection)getModelObject();
> >         if (collection == null)
> >         {
> >             collection = (Collection)getConvertedInput();
> >             setModelObject(collection);
> >         }
> >         else
> >         {
> >             modelChanging();
> >
> >             Collection input = (Collection)getConvertedInput();
> >             if(input != null && input.size() > 0) {
> >                 for (Iterator iterator = input.iterator();
> > iterator.hasNext();)
> > {
> >                     Object object = (Object)iterator.next();
> >                     if(!collection.contains(object)) {
> >                         collection.add(object);
> >                     }
> >                 }
> >             }
> >
> >             modelChanged();
> >         }
> >     }
> >
> >
> > On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > >
> > > and you are sure all links in the navigator are submit links? if so
> then
> > > post a quickstart and we will take a look
> > >
> > > -igor
> > >
> > >
> > > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > > >
> > > > I implemented hascode and equals on the row model object.  I still
> get
> > > the
> > > > same results.  I also added the onBeforeRender and onAfterRender to
> > the
> > > > page
> > > > to check the contents of the List.
> > > > From page 1 I checked two boxes.  I then hit the next page.  before
> > > render
> > > > and after render both and the two Objects in the list.  I then hit
> the
> > > > previous page link and before render and after render both had an
> > empty
> > > > list.
> > > >
> > > > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > > > >
> > > > > No, in my test I didn't include the hascode/equals methods.  I
> will
> > > give
> > > > > that a try.
> > > > >
> > > > > On 8/30/07, Igor Vaynberg < igor.vaynberg@gmail.com> wrote:
> > > > > >
> > > > > > and whatever that model is it has a proper hashcode/equals
> > > > implemented?
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > > > > > >
> > > > > > > Yes, I added an onSubmit method on the form and it has all the
> > > > checked
> > > > > > > models in the List.  Then it changes pages and the next time I
> > > > submit
> > > > > > or
> > > > > > > change pages, they are gone.
> > > > > > >
> > > > > > > On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > > > > > > >
> > > > > > > > are you sure they are being submitted properly, meaining
> does
> > > that
> > > > > > list
> > > > > > > > make
> > > > > > > > it into checkgroup's model when switch pages?
> > > > > > > >
> > > > > > > > -igor
> > > > > > > >
> > > > > > > > On 8/30/07, Tim Lantry <tlantry@gmail.com > wrote:
> > > > > > > > >
> > > > > > > > > I am using a Check component inside of a DataTable.  The
> > > > DataTable
> > > > > > is
> > > > > > > > > surrounded by a CheckGroup.  The model on each Check
> > component
> > > > is
> > > > > > the
> > > > > > > > Row
> > > > > > > > > Model.  This works great to get a list of checked rows.
> > > > > > > > >
> > > > > > > > > Is there a good way to retain the checks across pages?
> > > > > > > > >
> > > > > > > > > I created a new Navigator component that uses SubmitLinks
> > > > instead
> > > > > > of
> > > > > > > the
> > > > > > > > > Link component, but he List of models doesn't retain the
> > > objects
> > > > > > from
> > > > > > > > the
> > > > > > > > > previous page.
> > > > > > > > >
> > > > > > > > > Any suggestions?
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: CheckGroup in a DataTable

Posted by Igor Vaynberg <ig...@gmail.com>.
then the problem is that previously checked but now unchecked things wont be
cleared from your collection....

-igor

On 8/31/07, Tim Lantry <tl...@gmail.com> wrote:
>
> Ok.  I noticed in the updateModel method of the CheckGroup it is clearing
> the collection each time before adding the new ones to avoid duplicates in
> the collection.
> So I created a new component that extends the CheckGroup and changed the
> updateModel method.  I removed the collection.clear() and instead of
> adding
> all the items, I check to make sure they don't already exist.  Now it
> holds
> those checks across pages.
>
> public void updateModel()
>     {
>         Collection collection = (Collection)getModelObject();
>         if (collection == null)
>         {
>             collection = (Collection)getConvertedInput();
>             setModelObject(collection);
>         }
>         else
>         {
>             modelChanging();
>
>             Collection input = (Collection)getConvertedInput();
>             if(input != null && input.size() > 0) {
>                 for (Iterator iterator = input.iterator();
> iterator.hasNext();)
> {
>                     Object object = (Object)iterator.next();
>                     if(!collection.contains(object)) {
>                         collection.add(object);
>                     }
>                 }
>             }
>
>             modelChanged();
>         }
>     }
>
>
> On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> >
> > and you are sure all links in the navigator are submit links? if so then
> > post a quickstart and we will take a look
> >
> > -igor
> >
> >
> > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > >
> > > I implemented hascode and equals on the row model object.  I still get
> > the
> > > same results.  I also added the onBeforeRender and onAfterRender to
> the
> > > page
> > > to check the contents of the List.
> > > From page 1 I checked two boxes.  I then hit the next page.  before
> > render
> > > and after render both and the two Objects in the list.  I then hit the
> > > previous page link and before render and after render both had an
> empty
> > > list.
> > >
> > > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > > >
> > > > No, in my test I didn't include the hascode/equals methods.  I will
> > give
> > > > that a try.
> > > >
> > > > On 8/30/07, Igor Vaynberg < igor.vaynberg@gmail.com> wrote:
> > > > >
> > > > > and whatever that model is it has a proper hashcode/equals
> > > implemented?
> > > > >
> > > > > -igor
> > > > >
> > > > >
> > > > > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > > > > >
> > > > > > Yes, I added an onSubmit method on the form and it has all the
> > > checked
> > > > > > models in the List.  Then it changes pages and the next time I
> > > submit
> > > > > or
> > > > > > change pages, they are gone.
> > > > > >
> > > > > > On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > > > > > >
> > > > > > > are you sure they are being submitted properly, meaining does
> > that
> > > > > list
> > > > > > > make
> > > > > > > it into checkgroup's model when switch pages?
> > > > > > >
> > > > > > > -igor
> > > > > > >
> > > > > > > On 8/30/07, Tim Lantry <tlantry@gmail.com > wrote:
> > > > > > > >
> > > > > > > > I am using a Check component inside of a DataTable.  The
> > > DataTable
> > > > > is
> > > > > > > > surrounded by a CheckGroup.  The model on each Check
> component
> > > is
> > > > > the
> > > > > > > Row
> > > > > > > > Model.  This works great to get a list of checked rows.
> > > > > > > >
> > > > > > > > Is there a good way to retain the checks across pages?
> > > > > > > >
> > > > > > > > I created a new Navigator component that uses SubmitLinks
> > > instead
> > > > > of
> > > > > > the
> > > > > > > > Link component, but he List of models doesn't retain the
> > objects
> > > > > from
> > > > > > > the
> > > > > > > > previous page.
> > > > > > > >
> > > > > > > > Any suggestions?
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> >
>

Re: CheckGroup in a DataTable

Posted by Tim Lantry <tl...@gmail.com>.
Ok.  I noticed in the updateModel method of the CheckGroup it is clearing
the collection each time before adding the new ones to avoid duplicates in
the collection.
So I created a new component that extends the CheckGroup and changed the
updateModel method.  I removed the collection.clear() and instead of adding
all the items, I check to make sure they don't already exist.  Now it holds
those checks across pages.

public void updateModel()
    {
        Collection collection = (Collection)getModelObject();
        if (collection == null)
        {
            collection = (Collection)getConvertedInput();
            setModelObject(collection);
        }
        else
        {
            modelChanging();

            Collection input = (Collection)getConvertedInput();
            if(input != null && input.size() > 0) {
                for (Iterator iterator = input.iterator(); iterator.hasNext();)
{
                    Object object = (Object)iterator.next();
                    if(!collection.contains(object)) {
                        collection.add(object);
                    }
                }
            }

            modelChanged();
        }
    }


On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
>
> and you are sure all links in the navigator are submit links? if so then
> post a quickstart and we will take a look
>
> -igor
>
>
> On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> >
> > I implemented hascode and equals on the row model object.  I still get
> the
> > same results.  I also added the onBeforeRender and onAfterRender to the
> > page
> > to check the contents of the List.
> > From page 1 I checked two boxes.  I then hit the next page.  before
> render
> > and after render both and the two Objects in the list.  I then hit the
> > previous page link and before render and after render both had an empty
> > list.
> >
> > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > >
> > > No, in my test I didn't include the hascode/equals methods.  I will
> give
> > > that a try.
> > >
> > > On 8/30/07, Igor Vaynberg < igor.vaynberg@gmail.com> wrote:
> > > >
> > > > and whatever that model is it has a proper hashcode/equals
> > implemented?
> > > >
> > > > -igor
> > > >
> > > >
> > > > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > > > >
> > > > > Yes, I added an onSubmit method on the form and it has all the
> > checked
> > > > > models in the List.  Then it changes pages and the next time I
> > submit
> > > > or
> > > > > change pages, they are gone.
> > > > >
> > > > > On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > > > > >
> > > > > > are you sure they are being submitted properly, meaining does
> that
> > > > list
> > > > > > make
> > > > > > it into checkgroup's model when switch pages?
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > > On 8/30/07, Tim Lantry <tlantry@gmail.com > wrote:
> > > > > > >
> > > > > > > I am using a Check component inside of a DataTable.  The
> > DataTable
> > > > is
> > > > > > > surrounded by a CheckGroup.  The model on each Check component
> > is
> > > > the
> > > > > > Row
> > > > > > > Model.  This works great to get a list of checked rows.
> > > > > > >
> > > > > > > Is there a good way to retain the checks across pages?
> > > > > > >
> > > > > > > I created a new Navigator component that uses SubmitLinks
> > instead
> > > > of
> > > > > the
> > > > > > > Link component, but he List of models doesn't retain the
> objects
> > > > from
> > > > > > the
> > > > > > > previous page.
> > > > > > >
> > > > > > > Any suggestions?
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > >
> >
>

Re: CheckGroup in a DataTable

Posted by Igor Vaynberg <ig...@gmail.com>.
and you are sure all links in the navigator are submit links? if so then
post a quickstart and we will take a look

-igor


On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
>
> I implemented hascode and equals on the row model object.  I still get the
> same results.  I also added the onBeforeRender and onAfterRender to the
> page
> to check the contents of the List.
> From page 1 I checked two boxes.  I then hit the next page.  before render
> and after render both and the two Objects in the list.  I then hit the
> previous page link and before render and after render both had an empty
> list.
>
> On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> >
> > No, in my test I didn't include the hascode/equals methods.  I will give
> > that a try.
> >
> > On 8/30/07, Igor Vaynberg < igor.vaynberg@gmail.com> wrote:
> > >
> > > and whatever that model is it has a proper hashcode/equals
> implemented?
> > >
> > > -igor
> > >
> > >
> > > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > > >
> > > > Yes, I added an onSubmit method on the form and it has all the
> checked
> > > > models in the List.  Then it changes pages and the next time I
> submit
> > > or
> > > > change pages, they are gone.
> > > >
> > > > On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > > > >
> > > > > are you sure they are being submitted properly, meaining does that
> > > list
> > > > > make
> > > > > it into checkgroup's model when switch pages?
> > > > >
> > > > > -igor
> > > > >
> > > > > On 8/30/07, Tim Lantry <tlantry@gmail.com > wrote:
> > > > > >
> > > > > > I am using a Check component inside of a DataTable.  The
> DataTable
> > > is
> > > > > > surrounded by a CheckGroup.  The model on each Check component
> is
> > > the
> > > > > Row
> > > > > > Model.  This works great to get a list of checked rows.
> > > > > >
> > > > > > Is there a good way to retain the checks across pages?
> > > > > >
> > > > > > I created a new Navigator component that uses SubmitLinks
> instead
> > > of
> > > > the
> > > > > > Link component, but he List of models doesn't retain the objects
> > > from
> > > > > the
> > > > > > previous page.
> > > > > >
> > > > > > Any suggestions?
> > > > > >
> > > > >
> > > >
> > >
> >
> >
>

Re: CheckGroup in a DataTable

Posted by Tim Lantry <tl...@gmail.com>.
I implemented hascode and equals on the row model object.  I still get the
same results.  I also added the onBeforeRender and onAfterRender to the page
to check the contents of the List.
>From page 1 I checked two boxes.  I then hit the next page.  before render
and after render both and the two Objects in the list.  I then hit the
previous page link and before render and after render both had an empty
list.

On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
>
> No, in my test I didn't include the hascode/equals methods.  I will give
> that a try.
>
> On 8/30/07, Igor Vaynberg < igor.vaynberg@gmail.com> wrote:
> >
> > and whatever that model is it has a proper hashcode/equals implemented?
> >
> > -igor
> >
> >
> > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > >
> > > Yes, I added an onSubmit method on the form and it has all the checked
> > > models in the List.  Then it changes pages and the next time I submit
> > or
> > > change pages, they are gone.
> > >
> > > On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > > >
> > > > are you sure they are being submitted properly, meaining does that
> > list
> > > > make
> > > > it into checkgroup's model when switch pages?
> > > >
> > > > -igor
> > > >
> > > > On 8/30/07, Tim Lantry <tlantry@gmail.com > wrote:
> > > > >
> > > > > I am using a Check component inside of a DataTable.  The DataTable
> > is
> > > > > surrounded by a CheckGroup.  The model on each Check component is
> > the
> > > > Row
> > > > > Model.  This works great to get a list of checked rows.
> > > > >
> > > > > Is there a good way to retain the checks across pages?
> > > > >
> > > > > I created a new Navigator component that uses SubmitLinks instead
> > of
> > > the
> > > > > Link component, but he List of models doesn't retain the objects
> > from
> > > > the
> > > > > previous page.
> > > > >
> > > > > Any suggestions?
> > > > >
> > > >
> > >
> >
>
>

Re: CheckGroup in a DataTable

Posted by Tim Lantry <tl...@gmail.com>.
No, in my test I didn't include the hascode/equals methods.  I will give
that a try.

On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
>
> and whatever that model is it has a proper hashcode/equals implemented?
>
> -igor
>
>
> On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> >
> > Yes, I added an onSubmit method on the form and it has all the checked
> > models in the List.  Then it changes pages and the next time I submit or
> > change pages, they are gone.
> >
> > On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > >
> > > are you sure they are being submitted properly, meaining does that
> list
> > > make
> > > it into checkgroup's model when switch pages?
> > >
> > > -igor
> > >
> > > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > > >
> > > > I am using a Check component inside of a DataTable.  The DataTable
> is
> > > > surrounded by a CheckGroup.  The model on each Check component is
> the
> > > Row
> > > > Model.  This works great to get a list of checked rows.
> > > >
> > > > Is there a good way to retain the checks across pages?
> > > >
> > > > I created a new Navigator component that uses SubmitLinks instead of
> > the
> > > > Link component, but he List of models doesn't retain the objects
> from
> > > the
> > > > previous page.
> > > >
> > > > Any suggestions?
> > > >
> > >
> >
>

Re: CheckGroup in a DataTable

Posted by Igor Vaynberg <ig...@gmail.com>.
and whatever that model is it has a proper hashcode/equals implemented?

-igor


On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
>
> Yes, I added an onSubmit method on the form and it has all the checked
> models in the List.  Then it changes pages and the next time I submit or
> change pages, they are gone.
>
> On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> >
> > are you sure they are being submitted properly, meaining does that list
> > make
> > it into checkgroup's model when switch pages?
> >
> > -igor
> >
> > On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> > >
> > > I am using a Check component inside of a DataTable.  The DataTable is
> > > surrounded by a CheckGroup.  The model on each Check component is the
> > Row
> > > Model.  This works great to get a list of checked rows.
> > >
> > > Is there a good way to retain the checks across pages?
> > >
> > > I created a new Navigator component that uses SubmitLinks instead of
> the
> > > Link component, but he List of models doesn't retain the objects from
> > the
> > > previous page.
> > >
> > > Any suggestions?
> > >
> >
>

Re: CheckGroup in a DataTable

Posted by Tim Lantry <tl...@gmail.com>.
Yes, I added an onSubmit method on the form and it has all the checked
models in the List.  Then it changes pages and the next time I submit or
change pages, they are gone.

On 8/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
>
> are you sure they are being submitted properly, meaining does that list
> make
> it into checkgroup's model when switch pages?
>
> -igor
>
> On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
> >
> > I am using a Check component inside of a DataTable.  The DataTable is
> > surrounded by a CheckGroup.  The model on each Check component is the
> Row
> > Model.  This works great to get a list of checked rows.
> >
> > Is there a good way to retain the checks across pages?
> >
> > I created a new Navigator component that uses SubmitLinks instead of the
> > Link component, but he List of models doesn't retain the objects from
> the
> > previous page.
> >
> > Any suggestions?
> >
>

Re: CheckGroup in a DataTable

Posted by Igor Vaynberg <ig...@gmail.com>.
are you sure they are being submitted properly, meaining does that list make
it into checkgroup's model when switch pages?

-igor

On 8/30/07, Tim Lantry <tl...@gmail.com> wrote:
>
> I am using a Check component inside of a DataTable.  The DataTable is
> surrounded by a CheckGroup.  The model on each Check component is the Row
> Model.  This works great to get a list of checked rows.
>
> Is there a good way to retain the checks across pages?
>
> I created a new Navigator component that uses SubmitLinks instead of the
> Link component, but he List of models doesn't retain the objects from the
> previous page.
>
> Any suggestions?
>