import org.zkoss.zk.ui.util.Template;
import org.zkoss.zul.*;
+import java.util.ArrayList;
+import java.util.List;
+
@Log4j2
@Component
public class ReorderedItemsRenderer extends BindListitemRenderer {
@Override
public void render(Listitem item, final Object data, final int index) throws Exception {
log.info("Rendering item index {}, index {}", item.getIndex(), index);
-// int mappedIndex = columnSettings[index].getIndex();
final Listbox listbox = (Listbox) item.getParent();
final int size = listbox.getModel().getSize();
String subtype = item instanceof Listgroup ? "group" : (item instanceof Listgroupfoot ? "groupfoot" : null);
nli.setValue(data);
}
+ int mappedIndex = columnSettings[index].getIndex();
+ List<org.zkoss.zk.ui.Component> children = new ArrayList<>(nli.getChildren());
+ nli.getChildren().clear();
+ for (int i = 0; i < columnSettings.length; i++) {
+ org.zkoss.zk.ui.Component child = children.get(mappedIndex);
+ child.setParent(null);
+ nli.appendChild(child);
+ }
+
+
item.setAttribute("org.zkoss.zul.model.renderAs", nli);
item.detach();
}