Grid view scroll position lost for the following 2 scenario:
1. at grid view, scroll down and select a row so that part of the list is cut off from the top. open another window and comback, the list scroll back to top and the selected row is not visible until you scroll down to it. 2. at grid view, scroll down and select a row so that part of the list is cut off from the top. toggle to form view and back, the list scroll back to top and the selected row is not visible until you scroll down to it. Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2979746
This commit is contained in:
parent
7fc78215a4
commit
befe1e6ebe
|
@ -94,8 +94,10 @@ import org.zkoss.zul.Treeitem;
|
|||
public class ADTabpanel extends Div implements Evaluatee, EventListener,
|
||||
DataStatusListener, IADTabpanel, VetoableChangeListener
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 6811039639239312863L;
|
||||
/**
|
||||
* generated serial version ID
|
||||
*/
|
||||
private static final long serialVersionUID = 6945934489328360251L;
|
||||
|
||||
private static final CLogger logger;
|
||||
|
||||
|
@ -985,6 +987,7 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
|
|||
listPanel.setVisible(!formComponent.isVisible());
|
||||
if (listPanel.isVisible()) {
|
||||
listPanel.refresh(gridTab);
|
||||
listPanel.scrollToCurrentRow();
|
||||
} else {
|
||||
listPanel.deactivate();
|
||||
}
|
||||
|
@ -1145,6 +1148,10 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
|
|||
return listPanel.isVisible();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gTab
|
||||
* @return embedded panel or null if not found
|
||||
*/
|
||||
public IADTabpanel findEmbeddedPanel(GridTab gTab) {
|
||||
IADTabpanel panel = null;
|
||||
for(EmbeddedPanel ep : includedPanel) {
|
||||
|
@ -1154,5 +1161,13 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
|
|||
}
|
||||
return panel;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return GridPanel
|
||||
*/
|
||||
public GridPanel getGridView() {
|
||||
return listPanel;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.adempiere.webui.component.IADTab;
|
|||
import org.adempiere.webui.component.Tabbox;
|
||||
import org.adempiere.webui.component.Tabpanel;
|
||||
import org.adempiere.webui.component.Tabs;
|
||||
import org.adempiere.webui.part.ITabOnSelectHandler;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.util.UserPreference;
|
||||
import org.compiere.model.GridWindow;
|
||||
|
@ -182,6 +183,21 @@ public class ADWindowPanel extends AbstractADWindowPanel
|
|||
keyListener.setAutoBlur(false);
|
||||
}
|
||||
|
||||
layout.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() {
|
||||
public void onSelect() {
|
||||
IADTab adTab = getADTab();
|
||||
if (adTab != null) {
|
||||
IADTabpanel iadTabpanel = adTab.getSelectedTabpanel();
|
||||
if (iadTabpanel != null && iadTabpanel instanceof ADTabpanel) {
|
||||
ADTabpanel adTabpanel = (ADTabpanel) iadTabpanel;
|
||||
if (adTabpanel.isGridView()) {
|
||||
adTabpanel.getGridView().scrollToCurrentRow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,25 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2010 Low Heng Sin *
|
||||
* Copyright (C) 2010 Idalica Corporation *
|
||||
* 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.adempiere.webui.panel;
|
||||
|
||||
import org.adempiere.webui.component.Tabpanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface ITabOnCloseHandler {
|
||||
public void onClose(Tabpanel tabPanel);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2010 Low Heng Sin *
|
||||
* Copyright (C) 2010 Idalica Corporation *
|
||||
* 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.adempiere.webui.part;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface ITabOnSelectHandler {
|
||||
|
||||
public final static String ATTRIBUTE_KEY = "TabOnSelectHandler";
|
||||
|
||||
/**
|
||||
* handle tab on_select event
|
||||
*/
|
||||
public void onSelect();
|
||||
|
||||
}
|
|
@ -18,7 +18,13 @@ import org.adempiere.webui.component.Tabbox;
|
|||
import org.adempiere.webui.component.Tabpanel;
|
||||
import org.adempiere.webui.component.Tabpanels;
|
||||
import org.adempiere.webui.component.Tabs;
|
||||
import org.adempiere.webui.panel.ADTabpanel;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zkex.zul.Borderlayout;
|
||||
import org.zkoss.zkex.zul.Center;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -114,6 +120,20 @@ public class WindowContainer extends AbstractUIPart
|
|||
tab.setLabel(title);
|
||||
}
|
||||
tab.setClosable(closeable);
|
||||
|
||||
// fix scroll position lost coming back into a grid view tab
|
||||
tab.addEventListener(Events.ON_SELECT, new EventListener() {
|
||||
public void onEvent(Event event) throws Exception {
|
||||
Tab tab = (Tab)event.getTarget();
|
||||
org.zkoss.zul.Tabpanel panel = tab.getLinkedPanel();
|
||||
Component component = panel.getFirstChild();
|
||||
if (component != null && component.getAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY) instanceof ITabOnSelectHandler)
|
||||
{
|
||||
ITabOnSelectHandler handler = (ITabOnSelectHandler) component.getAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY);
|
||||
handler.onSelect();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Tabpanel tabpanel = null;
|
||||
if (comp instanceof Tabpanel) {
|
||||
|
|
Loading…
Reference in New Issue