diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java index ae58666bf7..22dea5acee 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java @@ -43,6 +43,7 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; +import org.zkoss.lang.Library; import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.au.out.AuScript; import org.zkoss.zk.ui.AbstractComponent; @@ -61,6 +62,7 @@ import org.zkoss.zul.Row; import org.zkoss.zul.Tabpanel; import org.zkoss.zul.Vbox; import org.zkoss.zul.event.ZulEvents; +import org.zkoss.zul.impl.CustomGridDataLoader; /** * Grid view implemented using the Grid component. @@ -155,6 +157,10 @@ public class GridView extends Vbox implements EventListener, IdSpace, IFi else { pageSize = MSysConfig.getIntValue(MSysConfig.ZK_PAGING_SIZE, DEFAULT_PAGE_SIZE); + String limit = Library.getProperty(CustomGridDataLoader.GRID_DATA_LOADER_LIMIT); + if (limit == null || !(limit.equals(Integer.toString(pageSize)))) { + Library.setProperty(CustomGridDataLoader.GRID_DATA_LOADER_LIMIT, Integer.toString(pageSize)); + } } //default true for better UI experience @@ -739,7 +745,7 @@ public class GridView extends Vbox implements EventListener, IdSpace, IFi */ public void onPostSelectedRowChanged() { removeAttribute(ATTR_ON_POST_SELECTED_ROW_CHANGED); - if (listbox.getRows().getChildren().isEmpty()) + if (listbox.getRows() == null || listbox.getRows().getChildren().isEmpty()) return; int rowIndex = gridTab.isOpen() ? gridTab.getCurrentRow() : -1; diff --git a/org.adempiere.ui.zk/WEB-INF/zk.xml b/org.adempiere.ui.zk/WEB-INF/zk.xml index 83ab683ff0..c869186d25 100644 --- a/org.adempiere.ui.zk/WEB-INF/zk.xml +++ b/org.adempiere.ui.zk/WEB-INF/zk.xml @@ -101,6 +101,14 @@ org.zkoss.web.util.resource.dir /WEB-INF/cwr + + org.zkoss.zul.grid.DataLoader.class + org.zkoss.zul.impl.CustomGridDataLoader + + + org.zkoss.zul.grid.rod + true + org.zkoss.zk.ui.WebApp.name diff --git a/org.zkoss.zk.library/src/org/zkoss/zul/impl/CustomGridDataLoader.java b/org.zkoss.zk.library/src/org/zkoss/zul/impl/CustomGridDataLoader.java new file mode 100644 index 0000000000..0b94c249c5 --- /dev/null +++ b/org.zkoss.zk.library/src/org/zkoss/zul/impl/CustomGridDataLoader.java @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright (C) 2014 TrekGlobal * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.zkoss.zul.impl; + +import org.zkoss.lang.Library; +import org.zkoss.zul.impl.GridDataLoader; + +/** + * @author hengsin + * + */ +public class CustomGridDataLoader extends GridDataLoader { + + public static final String GRID_DATA_LOADER_LIMIT = "org.zkoss.zul.grid.DataLoader.limit"; + + /** + * + */ + public CustomGridDataLoader() { + } + + /* (non-Javadoc) + * @see org.zkoss.zul.impl.GridDataLoader#getLimit() + */ + @Override + public int getLimit() { + String limit = Library.getProperty(GRID_DATA_LOADER_LIMIT); + if (limit != null) { + return Integer.parseInt(limit); + } + return super.getLimit(); + } + +}