public void sortTaskQualityForms() { Column columnName = (Column) assignedTaskQualityForms.getColumns() .getChildren().get(1); if (columnName != null) { if (columnName.getSortDirection().equals("ascending")) { columnName.sort(false, false); columnName.setSortDirection("ascending"); } else if (columnName.getSortDirection().equals("descending")) { columnName.sort(true, false); columnName.setSortDirection("descending"); } } }
private void renderColumns(Grid gridItems) { Columns columns = gridItems.getColumns(); // Create listhead first time is rendered if (columns == null) { columns = new Columns(); } // Delete all headers columns.getChildren().clear(); columns.setSizable(true); // Add static headers Column columnName = new Column(); columnName.setLabel(_("Name")); Util.setSort(columnName, "auto=(name)"); columnName.setSortDirection("ascending"); columns.appendChild(columnName); Column columnPosition = new Column(); columnPosition.setLabel(_("Position")); columns.appendChild(columnPosition); Column columnPercentage = new Column(); columnPercentage.setLabel(_("Percentage")); columns.appendChild(columnPercentage); Column columnPassed = new Column(); columnPassed.setLabel(_("Checked")); columns.appendChild(columnPassed); Column columnDate = new Column(); columnDate.setLabel(_("Date")); columns.appendChild(columnDate); columns.setParent(gridItems); }