IDEMPIERE-2041 Scrolling lag when paging size > 50.
This commit is contained in:
parent
b7117fbe7e
commit
7e804d8f80
|
@ -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<Event>, 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<Event>, 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;
|
||||
|
|
|
@ -101,6 +101,14 @@
|
|||
<name>org.zkoss.web.util.resource.dir</name>
|
||||
<value>/WEB-INF/cwr</value>
|
||||
</library-property>
|
||||
<library-property>
|
||||
<name>org.zkoss.zul.grid.DataLoader.class</name>
|
||||
<value>org.zkoss.zul.impl.CustomGridDataLoader</value>
|
||||
</library-property>
|
||||
<library-property>
|
||||
<name>org.zkoss.zul.grid.rod</name>
|
||||
<value>true</value>
|
||||
</library-property>
|
||||
|
||||
<preference>
|
||||
<name>org.zkoss.zk.ui.WebApp.name</name>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue