Note that there are some explanatory texts on larger screens.

plurals
  1. POGWT Multi columns sort with AsyncDataProvider
    text
    copied!<p>i have a table contains 3 columns, when the user clicks in one of them the table should be sorted, i'm using AsyncDataProvider, the sort for the first column works fine, so i should do the same to the others columns. this is the code : </p> <pre><code>AsyncDataProvider&lt;PermisoUI&gt; providerPerfiles = new AsyncDataProvider&lt;PermisoUI&gt;() { @Override protected void onRangeChanged(HasData&lt;PermisoUI&gt; display) { if(sortedPermiso) { sortedPermiso=false; class TipoCuotasComparator implements Comparator&lt;Object&gt; { public int compare(Object l1, Object l2) { PermisoUI o1 = (PermisoUI) l1; PermisoUI o2 = (PermisoUI) l2; return o2.getId().compareTo(o1.getId()); } } Collections.sort(listPermisos, new TipoCuotasComparator()); }else { sortedPermiso = true; class TipoCuotasComparator implements Comparator&lt;Object&gt; { public int compare(Object l1, Object l2) { PermisoUI o1 = (PermisoUI) l1; PermisoUI o2 = (PermisoUI) l2; return o1.getId().compareTo(o2.getId()); } } Collections.sort(listPermisos, new TipoCuotasComparator()); } int start = display.getVisibleRange().getStart(); int end = start + display.getVisibleRange().getLength(); end = end &gt;= listPermisos.size() ? listPermisos.size() : end; List&lt;PermisoUI&gt; sub = listPermisos.subList(start, end); updateRowData(start, sub); } }; providerPerfiles.addDataDisplay(CellTblPermisos); //Sorting Column AsyncHandler columnSortAplHandler = new AsyncHandler(CellTblPermisos); CellTblPermisos.addColumnSortHandler(columnSortAplHandler); CellTblPermisos.getColumnSortList().push(permisoColumn); providerPerfiles.addDataDisplay(CellTblPermisos); providerPerfiles.updateRowCount(listPermisos.size(), true); PPerfil.clear(); PPerfil.add(CellTblPermisos); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload