You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martijn Dashorst <ma...@gmail.com> on 2009/04/26 13:48:07 UTC

Re: PagingNavigator isn't working properly

How about providing your contacts listview with some actual objects to show?

new Model() doesn't provide a list to iterate through.

Martijn

On Sun, Apr 26, 2009 at 12:05 PM, HHB <hu...@yahoo.ca> wrote:
> Hey,
> I have a panel that consists of two divs:
> one for listing available groups.
> second will display contacts for a group.
> The contacts div will get populated upon clicking
> of group name.
> ******************************
> public class ContactsModel extends
>    LoadableDetachableModel {
>
>    private Long groupId;
>
>    @SpringBean
>    private Service service;
>
>    public ContactsModel(Long groupId) {
>        InjectorHolder.getInjector().inject(this);
>        this.groupId = groupId;
>    }
>
>    @Override
>    protected Object load() {
>        return service.
>        findContactsByGroupId(groupId);
>    }
>
> }
> ******************************
> public class ContactsPanel extends Panel {
>
>    public ContactsPanel(String id) {
>        super(id);
>        setOutputMarkupId(true);
>
>        final PageableListView contacts = new
>          PageableListView("contacts", new Model(), 10) {
>            @Override
>            protected void populateItem(ListItem item) {
>                Contact contact =
>                (Contact) item.getModelObject();
>                item.setModel(new
>                  CompoundPropertyModel(contact));
>                item.add(new Label("gsm"));
>            }
>        };
>        contacts.setOutputMarkupId(true);
>
>        final WebMarkupContainer wmc =
>           new WebMarkupContainer("contactsTable");
>        wmc.setOutputMarkupId(true);
>        wmc.add(contacts);
>        add(wmc);
>
>        ListView entry = new ListView("groups",
>            new GroupsModel()) {
>            @Override
>            protected void populateItem(ListItem item) {
>                final Group group = (Group) item.getModelObject();
>                item.setModel(new CompoundPropertyModel(group));
>                AjaxFallbackLink nameLink =
>                    new AjaxFallbackLink("nameLink") {
>                    @Override
>                    public void onClick(AjaxRequestTarget target) {
>                        Long groupId = group.getId();
>                        ContactsModel model =
>                        new ContactsModel(groupId);
>                        contacts.setModel(model);
>                        target.addComponent(wmc);
>                    }
>                };
>                nameLink.add(new Label("name"));
>                item.add(nameLink);
>            }
>        };
>        add(entry);
>
>        add(new
>            PagingNavigator("contactsNavigator", contacts));
>    }
>
> }
> ******************************
> <wicket:panel>
>    <div style="float: left; width:40%">
>        <div wicket:id="groups">
>            <a href="#" wicket:id="nameLink">
>  <span wicket:id="name">Group Name</span></a><br/>
>        </div>
>    </div>
>    <div>
>        <div style="float: right; width:60%">
>            <table wicket:id="contactsTable">
>                <th>GSM</th>
>                <tr wicket:id="contacts">
>                    <td>
>                    <span wicket:id="gsm">1111111111</span>
>                    </td>
>                </tr>
>            </table>
>            <div wicket:id="contactsNavigator"></div>
>        </div>
>    </div>
> </wicket:panel>
> ******************************
> When creating the contacts PageableListView,
> I have to provide a model and since no group is selected,
> I provided an empty Model()
> The problem is when clicking on a group name in order
> to get its contacts, the PagingNavigator is not working properly.
> It just displays << < > >>
> Any ideas what is going wrong?
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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


Re: PagingNavigator isn't working properly

Posted by HHB <hu...@yahoo.ca>.
I can't provide contacts listview some objects to show, that because when the
page is requested, no group is selected and the user has to click on group's
name in order to displays its contacts.
Adding the paging navigator to ajax request target solves the problem!!
Would you please tell why?
Thanks for help Martijn.


Martijn Dashorst wrote:
> 
> Ah, and how about adding the paging navigator to the ajax request target?
> 
> Martijn
> 
> On Sun, Apr 26, 2009 at 1:48 PM, Martijn Dashorst
> <ma...@gmail.com> wrote:
>> How about providing your contacts listview with some actual objects to
>> show?
>>
>> new Model() doesn't provide a list to iterate through.
>>
>> Martijn
>>
>> On Sun, Apr 26, 2009 at 12:05 PM, HHB <hu...@yahoo.ca> wrote:
>>> Hey,
>>> I have a panel that consists of two divs:
>>> one for listing available groups.
>>> second will display contacts for a group.
>>> The contacts div will get populated upon clicking
>>> of group name.
>>> ******************************
>>> public class ContactsModel extends
>>>    LoadableDetachableModel {
>>>
>>>    private Long groupId;
>>>
>>>    @SpringBean
>>>    private Service service;
>>>
>>>    public ContactsModel(Long groupId) {
>>>        InjectorHolder.getInjector().inject(this);
>>>        this.groupId = groupId;
>>>    }
>>>
>>>    @Override
>>>    protected Object load() {
>>>        return service.
>>>        findContactsByGroupId(groupId);
>>>    }
>>>
>>> }
>>> ******************************
>>> public class ContactsPanel extends Panel {
>>>
>>>    public ContactsPanel(String id) {
>>>        super(id);
>>>        setOutputMarkupId(true);
>>>
>>>        final PageableListView contacts = new
>>>          PageableListView("contacts", new Model(), 10) {
>>>            @Override
>>>            protected void populateItem(ListItem item) {
>>>                Contact contact =
>>>                (Contact) item.getModelObject();
>>>                item.setModel(new
>>>                  CompoundPropertyModel(contact));
>>>                item.add(new Label("gsm"));
>>>            }
>>>        };
>>>        contacts.setOutputMarkupId(true);
>>>
>>>        final WebMarkupContainer wmc =
>>>           new WebMarkupContainer("contactsTable");
>>>        wmc.setOutputMarkupId(true);
>>>        wmc.add(contacts);
>>>        add(wmc);
>>>
>>>        ListView entry = new ListView("groups",
>>>            new GroupsModel()) {
>>>            @Override
>>>            protected void populateItem(ListItem item) {
>>>                final Group group = (Group) item.getModelObject();
>>>                item.setModel(new CompoundPropertyModel(group));
>>>                AjaxFallbackLink nameLink =
>>>                    new AjaxFallbackLink("nameLink") {
>>>                    @Override
>>>                    public void onClick(AjaxRequestTarget target) {
>>>                        Long groupId = group.getId();
>>>                        ContactsModel model =
>>>                        new ContactsModel(groupId);
>>>                        contacts.setModel(model);
>>>                        target.addComponent(wmc);
>>>                    }
>>>                };
>>>                nameLink.add(new Label("name"));
>>>                item.add(nameLink);
>>>            }
>>>        };
>>>        add(entry);
>>>
>>>        add(new
>>>            PagingNavigator("contactsNavigator", contacts));
>>>    }
>>>
>>> }
>>> ******************************
>>> <wicket:panel>
>>>    <div style="float: left; width:40%">
>>>        <div wicket:id="groups">
>>>             # 
>>>  Group Name <br/>
>>>        </div>
>>>    </div>
>>>    <div>
>>>        <div style="float: right; width:60%">
>>>            <table wicket:id="contactsTable">
>>>                <th>GSM</th>
>>>                <tr wicket:id="contacts">
>>>                    <td>
>>>                    1111111111
>>>                    </td>
>>>                </tr>
>>>            </table>
>>>            <div wicket:id="contactsNavigator"></div>
>>>        </div>
>>>    </div>
>>> </wicket:panel>
>>> ******************************
>>> When creating the contacts PageableListView,
>>> I have to provide a model and since no group is selected,
>>> I provided an empty Model()
>>> The problem is when clicking on a group name in order
>>> to get its contacts, the PagingNavigator is not working properly.
>>> It just displays << < > >>
>>> Any ideas what is going wrong?
>>> Thanks.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.5 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
> 
> 
> 
> -- 
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/PagingNavigator-isn%27t-working-properly-tp23240851p23241742.html
Sent from the Wicket - User 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: PagingNavigator isn't working properly

Posted by Martijn Dashorst <ma...@gmail.com>.
Ah, and how about adding the paging navigator to the ajax request target?

Martijn

On Sun, Apr 26, 2009 at 1:48 PM, Martijn Dashorst
<ma...@gmail.com> wrote:
> How about providing your contacts listview with some actual objects to show?
>
> new Model() doesn't provide a list to iterate through.
>
> Martijn
>
> On Sun, Apr 26, 2009 at 12:05 PM, HHB <hu...@yahoo.ca> wrote:
>> Hey,
>> I have a panel that consists of two divs:
>> one for listing available groups.
>> second will display contacts for a group.
>> The contacts div will get populated upon clicking
>> of group name.
>> ******************************
>> public class ContactsModel extends
>>    LoadableDetachableModel {
>>
>>    private Long groupId;
>>
>>    @SpringBean
>>    private Service service;
>>
>>    public ContactsModel(Long groupId) {
>>        InjectorHolder.getInjector().inject(this);
>>        this.groupId = groupId;
>>    }
>>
>>    @Override
>>    protected Object load() {
>>        return service.
>>        findContactsByGroupId(groupId);
>>    }
>>
>> }
>> ******************************
>> public class ContactsPanel extends Panel {
>>
>>    public ContactsPanel(String id) {
>>        super(id);
>>        setOutputMarkupId(true);
>>
>>        final PageableListView contacts = new
>>          PageableListView("contacts", new Model(), 10) {
>>            @Override
>>            protected void populateItem(ListItem item) {
>>                Contact contact =
>>                (Contact) item.getModelObject();
>>                item.setModel(new
>>                  CompoundPropertyModel(contact));
>>                item.add(new Label("gsm"));
>>            }
>>        };
>>        contacts.setOutputMarkupId(true);
>>
>>        final WebMarkupContainer wmc =
>>           new WebMarkupContainer("contactsTable");
>>        wmc.setOutputMarkupId(true);
>>        wmc.add(contacts);
>>        add(wmc);
>>
>>        ListView entry = new ListView("groups",
>>            new GroupsModel()) {
>>            @Override
>>            protected void populateItem(ListItem item) {
>>                final Group group = (Group) item.getModelObject();
>>                item.setModel(new CompoundPropertyModel(group));
>>                AjaxFallbackLink nameLink =
>>                    new AjaxFallbackLink("nameLink") {
>>                    @Override
>>                    public void onClick(AjaxRequestTarget target) {
>>                        Long groupId = group.getId();
>>                        ContactsModel model =
>>                        new ContactsModel(groupId);
>>                        contacts.setModel(model);
>>                        target.addComponent(wmc);
>>                    }
>>                };
>>                nameLink.add(new Label("name"));
>>                item.add(nameLink);
>>            }
>>        };
>>        add(entry);
>>
>>        add(new
>>            PagingNavigator("contactsNavigator", contacts));
>>    }
>>
>> }
>> ******************************
>> <wicket:panel>
>>    <div style="float: left; width:40%">
>>        <div wicket:id="groups">
>>            <a href="#" wicket:id="nameLink">
>>  <span wicket:id="name">Group Name</span></a><br/>
>>        </div>
>>    </div>
>>    <div>
>>        <div style="float: right; width:60%">
>>            <table wicket:id="contactsTable">
>>                <th>GSM</th>
>>                <tr wicket:id="contacts">
>>                    <td>
>>                    <span wicket:id="gsm">1111111111</span>
>>                    </td>
>>                </tr>
>>            </table>
>>            <div wicket:id="contactsNavigator"></div>
>>        </div>
>>    </div>
>> </wicket:panel>
>> ******************************
>> When creating the contacts PageableListView,
>> I have to provide a model and since no group is selected,
>> I provided an empty Model()
>> The problem is when clicking on a group name in order
>> to get its contacts, the PagingNavigator is not working properly.
>> It just displays << < > >>
>> Any ideas what is going wrong?
>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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