Performance: use simple row focus indicator and fixed layout.
This commit is contained in:
parent
33fd4e4ae3
commit
877d0409ba
|
@ -39,6 +39,7 @@ import org.zkoss.zk.ui.event.Events;
|
|||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Frozen;
|
||||
import org.zkoss.zul.South;
|
||||
import org.zkoss.zul.Column;
|
||||
import org.zkoss.zul.Div;
|
||||
|
@ -89,12 +90,14 @@ public class GridPanel extends Borderlayout implements EventListener
|
|||
|
||||
private South south;
|
||||
|
||||
private boolean modeless;
|
||||
private boolean modeless = true;
|
||||
|
||||
private String columnOnClick;
|
||||
|
||||
private AbstractADWindowPanel windowPanel;
|
||||
|
||||
private boolean refreshing;
|
||||
|
||||
public static final String PAGE_SIZE_KEY = "ZK_PAGING_SIZE";
|
||||
|
||||
public static final String MODE_LESS_KEY = "ZK_GRID_EDIT_MODELESS";
|
||||
|
@ -118,8 +121,8 @@ public class GridPanel extends Borderlayout implements EventListener
|
|||
//default paging size
|
||||
pageSize = MSysConfig.getIntValue(PAGE_SIZE_KEY, 100);
|
||||
|
||||
//default false for better performance
|
||||
modeless = MSysConfig.getBooleanValue(MODE_LESS_KEY, false);
|
||||
//default true for better UI experience
|
||||
modeless = MSysConfig.getBooleanValue(MODE_LESS_KEY, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,11 +178,17 @@ public class GridPanel extends Borderlayout implements EventListener
|
|||
}
|
||||
else
|
||||
{
|
||||
refreshing = true;
|
||||
listbox.setModel(listModel);
|
||||
updateListIndex();
|
||||
refreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRefreshing() {
|
||||
return refreshing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update current row from model
|
||||
*/
|
||||
|
@ -253,6 +262,14 @@ public class GridPanel extends Borderlayout implements EventListener
|
|||
if (init) return;
|
||||
|
||||
Columns columns = new Columns();
|
||||
|
||||
Frozen frozen = new Frozen();
|
||||
frozen.setColumns(1);
|
||||
listbox.appendChild(frozen);
|
||||
org.zkoss.zul.Column indicator = new Column();
|
||||
indicator.setWidth("30px");
|
||||
|
||||
columns.appendChild(indicator);
|
||||
listbox.appendChild(columns);
|
||||
columns.setSizable(true);
|
||||
columns.setMenupopup("auto");
|
||||
|
@ -307,8 +324,8 @@ public class GridPanel extends Borderlayout implements EventListener
|
|||
LayoutUtils.addSclass("adtab-grid-panel", this);
|
||||
|
||||
listbox.setVflex(true);
|
||||
//true is faster but render badly on some browser
|
||||
listbox.setFixedLayout(false);
|
||||
//true might looks better, false for better performance
|
||||
listbox.setSizedByContent(false);
|
||||
listbox.addEventListener(Events.ON_CLICK, this);
|
||||
|
||||
updateModel();
|
||||
|
@ -401,6 +418,7 @@ public class GridPanel extends Borderlayout implements EventListener
|
|||
}
|
||||
}
|
||||
}
|
||||
event.stopPropagation();
|
||||
}
|
||||
else if (event.getTarget() == paging)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue