You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ASHU_JAVA <as...@gmail.com> on 2017/02/07 18:15:51 UTC
Java Wickets Delete and Checkbox
Hello All,
I'm a newbie to Java Wickets and want to implement following functionality:-
<http://apache-wicket.1842946.n4.nabble.com/file/n4677014/sample_2.png>
I want to use checkbox to select one, multiple or all rows and on "Delete"
button click, the users entry from Database Table gets removed and table
gets updated with remaining rows.
Can you please share some code samples to provide more insights to achieve
this functionality.
Thanks in advance.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Java-Wickets-Delete-and-Checkbox-tp4677014.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: Java Wickets Delete and Checkbox
Posted by ASHU_JAVA <as...@gmail.com>.
Hello All,
Here's a brief about my scenario:-
1) I've a Page with a custom Datatable that contains a list of category.
2) Onclick of any one category, a pop-up appears (I'm using model window for
this).
3) In the model window, we can view, add and delete users belonging to the
particular category. (I'm using Panel component).
4) Task to do:-
a) Delete one, multiple, and all users (Checkbox and Delete button)
b) Refresh the DataView of users (On addition/deletion of Users)
HTML code:-
Java Wicket Code:
Kindly provide inputs to perform these tasks.
Thanks in advance.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Java-Wickets-Delete-and-Checkbox-tp4677014p4677093.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: Java Wickets Delete and Checkbox
Posted by ASHU_JAVA <as...@gmail.com>.
Thanks Martin.
It worked now.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Java-Wickets-Delete-and-Checkbox-tp4677014p4677159.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: Java Wickets Delete and Checkbox
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
The problem is exactly what Jeremy said:
ArrayList list = manageCategory.findUsers(category.getCategoryname());
ArrayList finalList = new ArrayList();
final DataView dataView = new DataView("userTable", new ListDataProvider(
list)) {
You create the list and pass it to the DataView.
With DeleteUser(category) you delete entries in the database but the
DataView doesn't re-read from the DB them after that but still uses the
static list.
Instead of using "new ListDataProvider(list)" use the constructor without
parameters and
override org.apache.wicket.markup.repeater.data.ListDataProvider#getData()
{return manageCategory.findUsers(category.getCategoryname());}
Please read
https://ci.apache.org/projects/wicket/guide/7.x/single.html#_always_use_models
and try to understand the difference between simple/static and dynamic
models at
https://cwiki.apache.org/confluence/display/WICKET/Working+with+Wicket+models
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Mon, Feb 13, 2017 at 6:32 AM, ASHU_JAVA <as...@gmail.com> wrote:
> Hello Jeremy,
>
> I've provided my code. Can you please review and let me know, where I need
> to make an update.
>
> Thanks
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Java-Wickets-Delete-and-Checkbox-tp4677014p4677102.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: Java Wickets Delete and Checkbox
Posted by ASHU_JAVA <as...@gmail.com>.
Hello Jeremy,
I've provided my code. Can you please review and let me know, where I need
to make an update.
Thanks
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Java-Wickets-Delete-and-Checkbox-tp4677014p4677102.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: Java Wickets Delete and Checkbox
Posted by Jeremy Thomerson <je...@wickettraining.com>.
Ashu, the most likely cause of your problem is that the ListView is not
implemented correctly. Likely, rather than passing the ListView an
IModel<List<Foo>> you are passing it just a List<Foo> when it is created.
This leads to the ListView having stale data. Then you think you need to
"refresh" the ListView. In most cases when it is correctly implemented, the
ListView will "just work" because it will reload its model, getting the
up-to-date list after you've modified the underlying data store (e.g.
deleted things from the database).
The best way for you to get more assistance is to post a code snippet with
your next email that shows how you're creating the listview, the
checkboxes, and the delete.
On Tue, Feb 7, 2017 at 9:58 PM ASHU_JAVA <as...@gmail.com> wrote:
> Thanks Marcel for the link.
> I'm able to add checkbox group as provided in this link.
> However, I'm unable to refresh the list view once the item is deleted in
> the
> database.
>
> Can you please guide how to accomplish the task to refresh the listview
> (dataview)?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Java-Wickets-Delete-and-Checkbox-tp4677014p4677040.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: Java Wickets Delete and Checkbox
Posted by ASHU_JAVA <as...@gmail.com>.
Thanks Marcel for the link.
I'm able to add checkbox group as provided in this link.
However, I'm unable to refresh the list view once the item is deleted in the
database.
Can you please guide how to accomplish the task to refresh the listview
(dataview)?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Java-Wickets-Delete-and-Checkbox-tp4677014p4677040.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: Java Wickets Delete and Checkbox
Posted by Marcel Barbosa Pinto <ma...@gmail.com>.
Check here:
http://examples7x.wicket.apache.org/compref/wicket/bookmarkable/org.apache.wicket.examples.compref.CheckGroupPage
;
On Tue, Feb 7, 2017 at 4:15 PM, ASHU_JAVA <as...@gmail.com> wrote:
> Hello All,
>
> I'm a newbie to Java Wickets and want to implement following
> functionality:-
>
> <http://apache-wicket.1842946.n4.nabble.com/file/n4677014/sample_2.png>
>
> I want to use checkbox to select one, multiple or all rows and on "Delete"
> button click, the users entry from Database Table gets removed and table
> gets updated with remaining rows.
>
> Can you please share some code samples to provide more insights to achieve
> this functionality.
>
> Thanks in advance.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Java-Wickets-Delete-and-Checkbox-tp4677014.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
>
>
--
Marcel Barbosa Pinto
55 11 98255 8288