make the list sortable by default by state,but using alphabetic sort,
but the first tasks will be the pending tasks. FEA: ItEr75S32AnA15S04UpdateDeliveringDateInSubcontracting
This commit is contained in:
parent
c075e4434a
commit
1d95d90c2e
2 changed files with 32 additions and 5 deletions
|
|
@ -54,8 +54,11 @@ import org.zkoss.zk.ui.event.EventListener;
|
|||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Button;
|
||||
import org.zkoss.zul.Column;
|
||||
import org.zkoss.zul.Grid;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.ListModelExt;
|
||||
import org.zkoss.zul.Row;
|
||||
import org.zkoss.zul.RowRenderer;
|
||||
import org.zkoss.zul.api.Window;
|
||||
|
|
@ -71,6 +74,10 @@ public class SubcontractedTasksController extends GenericForwardComposer {
|
|||
|
||||
private Window window;
|
||||
|
||||
private Column columnBySort;
|
||||
|
||||
private Grid listing;
|
||||
|
||||
private Component messagesContainer;
|
||||
private IMessagesForUser messagesForUser;
|
||||
|
||||
|
|
@ -213,7 +220,7 @@ public class SubcontractedTasksController extends GenericForwardComposer {
|
|||
} catch (ValidationException e) {
|
||||
messagesForUser.showInvalidValues(e);
|
||||
}
|
||||
Util.reloadBindings(window);
|
||||
reload();
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -225,4 +232,23 @@ public class SubcontractedTasksController extends GenericForwardComposer {
|
|||
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
Util.reloadBindings(window);
|
||||
forceSortGridSatisfaction();
|
||||
}
|
||||
|
||||
public void forceSortGridSatisfaction() {
|
||||
Column column = (Column) columnBySort;
|
||||
ListModelExt model = (ListModelExt) listing.getModel();
|
||||
if ("ascending".equals(column.getSortDirection())) {
|
||||
model.sort(column.getSortAscending(), true);
|
||||
}
|
||||
if ("descending".equals(column.getSortDirection())) {
|
||||
model.sort(column.getSortDescending(), false);
|
||||
}
|
||||
}
|
||||
|
||||
public void initRender() {
|
||||
forceSortGridSatisfaction();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,10 +38,11 @@
|
|||
<grid id="listing"
|
||||
model="@{controller.subcontractedTasks}"
|
||||
rowRenderer="@{controller.subcontractedTasksRenderer}"
|
||||
mold="paging" pageSize="10" fixedLayout="true">
|
||||
mold="paging" pageSize="10" fixedLayout="true"
|
||||
onInitRender="controller.initRender();">
|
||||
<columns>
|
||||
<column label="${i18n:_('Subcontracting date')}"
|
||||
tooltiptext="${i18n:_('Subcontracting date')}" sort="auto(subcontratationDate)" />
|
||||
tooltiptext="${i18n:_('Subcontracting date')}" sort="auto(subcontratationDate)" width="150px"/>
|
||||
<column label="${i18n:_('Communication')}" sort="auto(communicationdate)"
|
||||
tooltiptext="${i18n:_('Communication date')}" />
|
||||
<column label="${i18n:_('Company')}" tooltiptext="${i18n:_('External company')}" sort="auto(externalcompany)" />
|
||||
|
|
@ -50,8 +51,8 @@
|
|||
<column label="${i18n:_('Task name')}" tooltiptext="${i18n:_('Task name')}" />
|
||||
<column label="${i18n:_('Description')}" tooltiptext="${i18n:_('Work description')}" />
|
||||
<column label="${i18n:_('Budget')}" tooltiptext="${i18n:_('Budget')}" />
|
||||
<column label="${i18n:_('State')}" tooltiptext="${i18n:_('State')}" />
|
||||
<column label="${i18n:_('Operations')}" tooltiptext="${i18n:_('Operations')}" width="150px"/>
|
||||
<column id="columnBySort" label="${i18n:_('State')}" tooltiptext="${i18n:_('State')}" sort="auto(state)" sortDirection="ascending"/>
|
||||
<column label="${i18n:_('Operations')}" tooltiptext="${i18n:_('Operations')}" width="100px"/>
|
||||
</columns>
|
||||
</grid>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue