import org.springframework.stereotype.Component;
import org.zkoss.bind.BindUtils;
import org.zkoss.zul.FieldComparator;
+import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listheader;
import org.zkoss.zul.event.ListDataEvent;
public void addColumns(List<ColDef> columns) {
Profile profile = currentProfile.getSetting(getClass().getSimpleName());
- ColDef[] savedColumns = validSavedColumns(profile, columns);
+ ColDef[] savedColumns = getValidSavedColumns(profile, columns);
if (Objects.isNull(savedColumns)) {
renderer.setColumnSettings(columns.toArray(new ColDef[]{}));
saveProfileSetting();
columns.forEach(this::setSortDirection);
}
- private ColDef[] validSavedColumns(Profile profile, List<ColDef> columns) {
+ private ColDef[] getValidSavedColumns(Profile profile, List<ColDef> columns) {
ColDef[] savedColumns;
if (Objects.isNull(profile)) {
return null;
public void onHeaderMenuClicked(ColDef node) {
node.setVisible(!node.isVisible());
saveProfileSetting();
- BindUtils.postNotifyChange(this, "columnSettings");
+ BindUtils.postNotifyChange(renderer, "columnSettings");
}
public void onHeaderSizeChanged(int colIndex, String changedWidth) {
ColDef node = renderer.getColumnSettings()[colIndex];
node.setWidth(changedWidth);
saveProfileSetting();
- BindUtils.postNotifyChange(this, "columnSettings");
+ BindUtils.postNotifyChange(renderer, "columnSettings");
}
public void onHeaderReorder(Listheader dragged, Listheader dropped) {
renderer.getColumnSettings()[dropColIndex] = renderer.getColumnSettings()[dragColIndex];
renderer.getColumnSettings()[dragColIndex] = dropNode;
saveProfileSetting();
- BindUtils.postNotifyChange(this, "columnSettings");
+
+ Listbox parent = (Listbox) dragged.getParent().getParent();
+ parent.invalidate();
+ BindUtils.postNotifyChange(renderer, "columnSettings");
fireEvent(ListDataEvent.STRUCTURE_CHANGED, -1, -1);
}
List<org.zkoss.zk.ui.Component> children = new ArrayList<>(nli.getChildren());
nli.getChildren().clear();
+// nli.appendChild(children.get(3));
+// nli.appendChild(children.get(2));
+// nli.appendChild(children.get(1));
+// nli.appendChild(children.get(0));
+
for (int i = 0; i < columnSettings.length; i++) {
int mappedIndex = columnSettings[i].getIndex();
org.zkoss.zk.ui.Component child = children.get(mappedIndex);
- //child.setParent(null);
nli.appendChild(child);
}
</menupopup>
<listbox vflex="true" model="@load(vm.partnersDataModel)"
itemRenderer="@load(vm.partnersDataModel.renderer)"
- autopaging="true" mold="paging" pagingPosition="top" multiple="false"
+ autopaging="true" multiple="false"
onSelect="@command('onListSelection')">
<listhead sizable="true" menupopup="editPopup"
onColSize="@command('onHeaderSizeChanged', node=node)"