[GWT 2.3] Problème pagination dans un CellTable
Bonjour à tous,
J'ai un petit soucis avec la pagination de ma CellTable car elle ne s'affiche pas (je n'ai pas les petites flèches en dessous du tableau).
Mes attributs de classe :
Code:
1 2 3 4
|
private CellTable<Personne> cellTable;
private List<Personne> listeElementsTableau;
private SimplePager pagineur; |
Voici ma méthode qui initialise mon tableau au lancement de l'application :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
public void construireTableau() {
cellTable = new CellTable<Personne>(10);
cellTable.setWidth("100%", true);
TextColumn<Personne> colonnePrenom = new TextColumn<Personne>() {
@Override
public String getValue(Personne object) {
return object.getPrenom();
}
};
colonnePrenom.setSortable(true);
TextColumn<Personne> colonneNom = new TextColumn<Personne>() {
@Override
public String getValue(VersionStructureDTO object) {
return object.getNom();
}
};
cellTable.setColumnWidth(colonnePrenom , 35.0, Unit.PCT);
cellTable.setColumnWidth(colonneNom , 65.0, Unit.PCT);
cellTable.addColumn(colonnePrenom , "Prénom");
cellTable.addColumn(colonneNom , "Nom");
SimplePager.Resources paginateurResources = GWT.create(SimplePager.Resources.class);
pagineur = new SimplePager(TextLocation.CENTER, paginateurResources, false, 0, true);
pagineur.setDisplay(cellTable);
ListDataProvider<Personne> provider = new ListDataProvider<Personne>();
provider .addDataDisplay(cellTable);
listeElementsTableau = provider .getList();
ListHandler<Personne> triHandler = new ListHandler<Personne>(listeElementsTableau);
triHandler.setComparator(colonnePrenom , new Comparator<Personne>() {
public int compare(Personne o1, Personne o2) {
return o1.getPrenom().compareTo(o2.getPrenom());
}
});
cellTable.addColumnSortHandler(triHandler);
// Ajoute le tableau dans l'écran
panelVertical.add(cellTable);
panelPrincipal.add(panelVertical);
} |
Et voici ma méthode qui rempli le tableau après un appel RPC :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
public void afficherListeResultats(Personne[] listeResultats) {
for (int i = 0; i < listeElementsTableau.size(); i++) {
cellTable.removeColumn(i);
}
listeElementsTableau.clear();
List<Personne> resultatsRecherche = Arrays.asList(listeResultats);
cellTable.setRowCount(resultatsRecherche.size(), true);
for (Personne resultat : resultatsRecherche) {
listeElementsTableau.add(resultat);
} |
J'ai bien mes données dans mon tableau mais pas les flèches qui gèrent la pagination. :(
Si quelqu'un aurait une idée, ce serait sympa.