You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by elesi <js...@gmail.com> on 2010/10/01 07:21:09 UTC
alphabetical paging navigator
is it possible to override the PagingNavigator and give it the letters A-Z as
links? and add filtering behavior so that it only shows ListView items that
starts with/matches the active letter link?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/alphabetical-paging-navigator-tp2837010p2837010.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: alphabetical paging navigator
Posted by Mathias Nilsson <wi...@gmail.com>.
This can be implemented in a better way. See source code for navigation in
wicket. But here is a simple example
// Create a panel
import java.util.LinkedList;
import java.util.List;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
public abstract class AlphabeticalPanel extends Panel{
private static final long serialVersionUID = 1L;
public AlphabeticalPanel(String id) {
super(id);
IModel<List<String>> alphabeticalModel = new
LoadableDetachableModel<List<String>>(){
private static final long serialVersionUID = 1L;
@Override
protected List<String> load() {
List<String> alphabet = new LinkedList<String>();
char letter;
for(letter = 'A'; letter <= 'Z'; letter++) {
alphabet.add( "" + letter );
}
return alphabet;
}
};
ListView<String> alphabeticalView = new ListView<String>(
"alphabeticalView",alphabeticalModel ){
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<String> item) {
final String character = item.getModelObject();
AjaxLink<Void> link = new AjaxLink<Void>( "link" ){
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
onCharacterClicked(character,target);
}
};
link.add( new Label( "character" , character ));
item.add( link );
}
};
add( alphabeticalView );
}
public abstract void onCharacterClicked( String character,
AjaxRequestTarget target );
}
// Add the panel to a page
add( new AlphabeticalPanel( "panel" ){
private static final long serialVersionUID = 1L;
@Override
public void onCharacterClicked(String character,AjaxRequestTarget target)
{
// Here you get the char. Get the data from database and add another
view with the data
}
});
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/alphabetical-paging-navigator-tp2837010p2859832.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: alphabetical paging navigator
Posted by elesi <js...@gmail.com>.
can you give an idea on how to do that?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/alphabetical-paging-navigator-tp2837010p2853331.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: alphabetical paging navigator
Posted by Igor Vaynberg <ig...@gmail.com>.
it wouldnt be worth overriding one, you are better off creating one
from scratch.
listview and paging navigator are decoupled, so you can use your own
impl to page the listview without problems.
-igor
On Thu, Sep 30, 2010 at 10:21 PM, elesi <js...@gmail.com> wrote:
>
> is it possible to override the PagingNavigator and give it the letters A-Z as
> links? and add filtering behavior so that it only shows ListView items that
> starts with/matches the active letter link?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/alphabetical-paging-navigator-tp2837010p2837010.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