You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by dhongyt <da...@gmail.com> on 2013/04/15 22:12:55 UTC

AjaxFallbackDefaultDataTable and CheckBox Column

I'm having a tough time understanding how I can get the objects selected.
Currently I have an AjaxFallbackDefaultDataTable with a Column of CheckBox.

I implemented a CheckBoxPanel so that I can add that to an AbstractColumn.
The AjaxFallbackDefaultDataTable is within a form and contains a form button
that I'm hoping to grab all the CheckBox checked.

I know that I need to put the functionality in the Form onSubmit section,
but having a tough time understanding how I can get the CheckBox checked.

CheckBoxPanel.java


CheckBoxPanel.html


Table.java


David



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
Hi,

the classes in the following archive duplicate AjaxNavigationToolbar but 
use AjaxFormSubmitBehaviors instead:

https://dl.dropboxusercontent.com/u/52076310/AjaxSubmitPaging.zip

Usage:

     Form form = new Form("form");
     add(form);

     form.add(new AjaxSubmitDefaultDataTable<Foo, String>("table", 
columns, dataProvider, 8));

Hope this helps
Sven


On 04/19/2013 09:52 PM, dhongyt wrote:
> Right which is what I have but I'm having a tough time understanding how I
> need to override the navigator.
>
>
>
> I have done it many ways and none of them seem to work.
>
> I think I'm supposed to override this
>
>
> But SubmitLink wants the form to be in its constructor for it to work
> correctly right?
> And how to I make it update the DataView to go to the next page?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658133.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
Right which is what I have but I'm having a tough time understanding how I
need to override the navigator.



I have done it many ways and none of them seem to work.

I think I'm supposed to override this


But SubmitLink wants the form to be in its constructor for it to work
correctly right?
And how to I make it update the DataView to go to the next page?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658133.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
Easiest is to wrap the whole table in a form.

Sven

On 04/19/2013 07:34 PM, dhongyt wrote:
> I have been playing some more with the code and I'm now thinking that maybe I
> should just overrite the newNavigation function.
>
> That will allow me to override the newPagingNavigationLink function.
>
> My troubles are that if I want to return a SubmitLink here, where would my
> form tags be in the mark up? And where should I create the form component?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658129.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
I have been playing some more with the code and I'm now thinking that maybe I
should just overrite the newNavigation function.

That will allow me to override the newPagingNavigationLink function.

My troubles are that if I want to return a SubmitLink here, where would my
form tags be in the mark up? And where should I create the form component?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658129.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
I noticed that I was using PagingNavigator instead of the PagingNavigation.

Changed my code over to use PagingNavigation results in:
Last cause: The component(s) below failed to render. Possible reasons could
be that: 1) you have added a component in code but forgot to reference it in
the markup (thus the component will never be rendered), 2) if your
components were added in a parent container then make sure the markup for
the child container includes them in <wicket:extend>.

1. [PagingNavigation [Component id = navigation]]
2. [LoopItem [Component id = 0]]
3. [PagingNavigationLink [Component id = pageLink]]
4. [Component id = pageNumber]
5. [LoopItem [Component id = 1]]
6. [PagingNavigationLink [Component id = pageLink]]
7. [Component id = pageNumber]
8. [LoopItem [Component id = 2]]
9. [PagingNavigationLink [Component id = pageLink]]
10. [Component id = pageNumber]
11. [LoopItem [Component id = 3]]
12. [PagingNavigationLink [Component id = pageLink]]
13. [Component id = pageNumber]
14. [LoopItem [Component id = 4]]
15. [PagingNavigationLink [Component id = pageLink]]
16. [Component id = pageNumber]
17. [LoopItem [Component id = 5]]
18. [PagingNavigationLink [Component id = pageLink]]
19. [Component id = pageNumber]
20. [LoopItem [Component id = 6]]
21. [PagingNavigationLink [Component id = pageLink]]
22. [Component id = pageNumber]
23. [LoopItem [Component id = 7]]
24. [PagingNavigationLink [Component id = pageLink]]
25. [Component id = pageNumber]
26. [LoopItem [Component id = 8]]
27. [PagingNavigationLink [Component id = pageLink]]
28. [Component id = pageNumber]
29. [LoopItem [Component id = 9]]
30. [PagingNavigationLink [Component id = pageLink]]
31. [Component id = pageNumber]
32. [PagingNavigationLink [Component id = first]]
33. [PagingNavigationIncrementLink [Component id = prev]]
34. [PagingNavigationIncrementLink [Component id = next]]
35. [PagingNavigationLink [Component id = last]]



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658119.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.

This is the markup that I have. The span "navigation" closing tag is
obviously there. Am I missing something?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658118.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
Check SubmitLinkPagingNavigator's markup.

Sven

On 04/19/2013 12:03 AM, dhongyt wrote:
> I think I wrapped my head on it a bit more and starting to understand what
> navigation is.
> So now I have this.
>
>
> I believe I need to override the PagingNavigator populateItem function but
> I'm trying to get a regular population working but now I have this error:
>
> Last cause: Close tag not found for tag: . For PagingNavigator Components
> only raw markup is allow in between the tags but not other Wicket Component.
> Component: [PagingNavigator [Component id = navigation]]
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658100.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
I think I wrapped my head on it a bit more and starting to understand what
navigation is.
So now I have this.


I believe I need to override the PagingNavigator populateItem function but
I'm trying to get a regular population working but now I have this error:

Last cause: Close tag not found for tag: . For PagingNavigator Components
only raw markup is allow in between the tags but not other Wicket Component.
Component: [PagingNavigator [Component id = navigation]]



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658100.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
So I'm trying to override the PagingNavigator by creating my own custom
navigator.





My issue is that for some reason I can't seem to put the page numbers on
pageNumber.
My error is:
Unable to find component with id 'navigation' in [Form [Component id =
linkForm]]

Not quite sure what navigation is supposed to be.

Am I going about this correctly?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658099.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
Either you have a AjaxFormComponentUpdatingBehavior on each Checkbox, so 
a selection is automatically synced to the server.

Or you make the paging submit a containing form:

http://apache-wicket.1842946.n4.nabble.com/Wicket-user-Editable-DataTable-with-Paging-td1925442.html

Regards
Sven

On 04/17/2013 08:35 PM, dhongyt wrote:
> So if I would like to store the checks on many different pages, then I would
> have to override the AjaxPagingNavigationBehavior function? And in that
> function when the page changes save the current CheckBox ArrayList into some
> sort of HashMap maybe? And load the page of checks depending on the page?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658061.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
So if I would like to store the checks on many different pages, then I would
have to override the AjaxPagingNavigationBehavior function? And in that
function when the page changes save the current CheckBox ArrayList into some
sort of HashMap maybe? And load the page of checks depending on the page?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658061.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
Hi,

on each click, AjaxFormChoiceUpdatingBehavior sends *all* checked 
checkboxes to the server, overwriting the previously selected with the 
now selected ones.
For a paging DataTable only those checkboxes from the current paging are 
visible, thus the selection from the previous paging is lost.

Hope this helps
Sven

On 04/16/2013 08:37 PM, dhongyt wrote:
> Could you please explain the reason why we lose the CheckGroup from the
> previous paging?
>
> Is it because the CheckGroup is set on the first 50 and when going to the
> next 50 it creates a new CheckGroup therefore losing the first CheckGroup?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658046.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
Could you please explain the reason why we lose the CheckGroup from the
previous paging?

Is it because the CheckGroup is set on the first 50 and when going to the
next 50 it creates a new CheckGroup therefore losing the first CheckGroup?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658046.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
Sorry, you're right, you have to add the behavior to the CheckGroup.

And you're right too that the CheckGroup will lose its selection from a 
previous paging.
I'm afraid you'll have to implement your own solution with ChekBoxes and 
an AjaxFormComponentBehavior, managing the selected items in your own 
collection.

Sven

On 04/16/2013 07:32 PM, dhongyt wrote:
> Looks like it does save. I created an AjaxFormChoiceComponentBehavior on my
> CheckGroup.
>
> When I do the check on page one, go to page 2, and return the checks are
> still there.
> When I do the check on page one, go to page 2, and check off items in page
> 2, and return to page one check on page one are gone.
>
>
>
> I think I am beginning to understand my problem.
> Is it because when I do a
>
>
> The group is only added to the first 50 items that show up, so if I want it
> to work with the rest of the pages, does that mean that I also have to
> implement the AjaxPagingNavigationBehavior?
>
> Or am I just missing something on the onUpdate function?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658042.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
Looks like it does save. I created an AjaxFormChoiceComponentBehavior on my
CheckGroup.

When I do the check on page one, go to page 2, and return the checks are
still there.
When I do the check on page one, go to page 2, and check off items in page
2, and return to page one check on page one are gone.



I think I am beginning to understand my problem.
Is it because when I do a


The group is only added to the first 50 items that show up, so if I want it
to work with the rest of the pages, does that mean that I also have to
implement the AjaxPagingNavigationBehavior?

Or am I just missing something on the onUpdate function?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658042.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
I have added this to my check


But now I get the error "Behavior can only be added to an instance of a
FormComponent"

I was looking at the javadoc and seems to me that Check is not a
FormComponent, do you mean for me to add this behavior to the CheckGroup?
But adding it to the CheckGroup doesn't make much sense to me.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658040.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
Hi,

you'll have to add FormChoiceComponentUpdatingBehavior to your Check 
components, so selection is sent to the server immediately.

Regards
Sven

On 04/16/2013 05:05 PM, dhongyt wrote:
> Thanks again Sven.
>
> I was able to implement the CheckGroup/Check functionality to the DataTable
> but the results I am expecting isn't quite what I want. Not sure if its an
> issue of implementation or if it supposed to work like that.
>
> When I select the checkboxes on the first page, go to page 2, and return to
> page 1 the checkboxes disappear.
>
> When I select the checkboxes on the first page, submit my selection, go to
> page 2 and return to page 1 the checkboxes are still there.
>
> When I select the checkboxes on the first page, submit my selection, go to
> page 2, select a checkbox and hit submit, selection from page one is gone,
> but page 2 selection is there.
>
> Is that how CheckGroup/Check supposed to work?
> Since you describe that if you wanted the checks to persist on all pages I
> assumed this is wrong?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658031.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
Thanks again Sven.

I was able to implement the CheckGroup/Check functionality to the DataTable
but the results I am expecting isn't quite what I want. Not sure if its an
issue of implementation or if it supposed to work like that.

When I select the checkboxes on the first page, go to page 2, and return to
page 1 the checkboxes disappear.

When I select the checkboxes on the first page, submit my selection, go to
page 2 and return to page 1 the checkboxes are still there.

When I select the checkboxes on the first page, submit my selection, go to
page 2, select a checkbox and hit submit, selection from page one is gone,
but page 2 selection is there.

Is that how CheckGroup/Check supposed to work?
Since you describe that if you wanted the checks to persist on all pages I
assumed this is wrong?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658031.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/org.apache.wicket.examples.compref.CheckGroupPage

It uses a ListView instead of a DataTable, but usage of CheckGroup/Check 
is the same.

Hope this helps
Sven

On 04/15/2013 10:53 PM, dhongyt wrote:
> Thanks Sven.
>
> For the CheckGroup/Check which wicket-example are you talking about?
> Are you talking about the ones on this page?
> http://www.wicket-library.com/wicket-examples/index.html
>
> If so then which example are you talking about on that page?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658002.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
Thanks Sven.

For the CheckGroup/Check which wicket-example are you talking about?
Are you talking about the ones on this page?
http://www.wicket-library.com/wicket-examples/index.html

If so then which example are you talking about on that page?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658002.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
Wicket iterates all files anyway for rendering, so iterating them once 
again to find the selected ones will be no problem.

If you want to keep selection across paging on your DataTable, you 
should definitely look into using CheckGroup/Check.

Sven

On 04/15/2013 10:32 PM, dhongyt wrote:
> If there are tons of files that might be listed, iterating through all those
> files just to see which on is select could present a time issue correct?
>
> Will CheckGroup and Check components solve this issue?
>
> Is there a way to just grab checked files instead of iterating though and
> seeing which one is checked?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658000.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>




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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by dhongyt <da...@gmail.com>.
If there are tons of files that might be listed, iterating through all those
files just to see which on is select could present a time issue correct?

Will CheckGroup and Check components solve this issue?

Is there a way to just grab checked files instead of iterating though and
seeing which one is checked?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998p4658000.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxFallbackDefaultDataTable and CheckBox Column

Posted by Sven Meier <sv...@meiers.net>.
Does your File object have a boolean property to store the selection in?

Then you have to bind your chechbox to the property:

     public CheckboxPanel(String id, IModel<File> model)
     {
         super(id, model);
         add(new CheckBox("check", new PropertyModel<Boolean>(model, "selected"));
     }

In your #onSubmit() iterate over all files and filter out the selected ones.

Otherwise I'd recommend using a CheckGroup and Check components for each 
row.
See wicket-examples' CheckGroupPage.java (no DataTable used though).

Regards
Sven

On 04/15/2013 10:12 PM, dhongyt wrote:
> I'm having a tough time understanding how I can get the objects selected.
> Currently I have an AjaxFallbackDefaultDataTable with a Column of CheckBox.
>
> I implemented a CheckBoxPanel so that I can add that to an AbstractColumn.
> The AjaxFallbackDefaultDataTable is within a form and contains a form button
> that I'm hoping to grab all the CheckBox checked.
>
> I know that I need to put the functionality in the Form onSubmit section,
> but having a tough time understanding how I can get the CheckBox checked.
>
> CheckBoxPanel.java
>
>
> CheckBoxPanel.html
>
>
> Table.java
>
>
> David
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-and-CheckBox-Column-tp4657998.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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