Skip to content

Commit

Permalink
Disable buffered view and auto scroll in timestamp refresh
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Mezzasalma <claudio.mezzasalma@eurotech.com>
  • Loading branch information
Claudio Mezzasalma authored and Coduz committed May 5, 2020
1 parent cec2ca6 commit b5755d8
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2020 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.app.console.module.api.client.ui.grid;

import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGrid;

public class KapuaTreeGrid<M extends ModelData> extends TreeGrid<M> {

public KapuaTreeGrid(TreeStore store, ColumnModel cm) {
super(store, cm);
setView(new KapuaTreeGridView());
}

}
@@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2020 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.app.console.module.api.client.ui.grid;

import com.extjs.gxt.ui.client.widget.treegrid.TreeGridView;

public class KapuaTreeGridView extends TreeGridView {

public KapuaTreeGridView() {
super();
preventScrollToTopOnRefresh = true;
}

}
Expand Up @@ -43,6 +43,7 @@
import org.eclipse.kapua.app.console.module.api.client.resources.icons.IconSet;
import org.eclipse.kapua.app.console.module.api.client.resources.icons.KapuaIcon;
import org.eclipse.kapua.app.console.module.api.client.ui.button.Button;
import org.eclipse.kapua.app.console.module.api.client.ui.grid.KapuaTreeGrid;
import org.eclipse.kapua.app.console.module.api.client.util.FailureHandler;
import org.eclipse.kapua.app.console.module.api.shared.model.session.GwtSession;
import org.eclipse.kapua.app.console.module.data.client.messages.ConsoleDataMessages;
Expand Down Expand Up @@ -76,6 +77,7 @@ public void onSuccess(List<GwtTopic> topics) {
store.sort("topicName", Style.SortDir.ASC);
updateTimestamps(new ArrayList<ModelData>(topics));
topicInfoGrid.unmask();
topicInfoGrid.getView().scrollToTop();
refreshButton.enable();
}

Expand Down Expand Up @@ -159,7 +161,7 @@ private void initTopicInfoGrid() {
store = new TreeStore<GwtTopic>();
store.setSortInfo(new SortInfo("topicName", Style.SortDir.ASC));
dataService.findTopicsTree(currentSession.getSelectedAccountId(), topicsCallback);
topicInfoGrid = new TreeGrid<GwtTopic>(store, new ColumnModel(configs));
topicInfoGrid = new KapuaTreeGrid<GwtTopic>(store, new ColumnModel(configs));
topicInfoGrid.getView().setViewConfig(new GridViewConfig() {
@Override
public String getRowStyle(ModelData model, int rowIndex, ListStore<ModelData> ds) {
Expand Down

0 comments on commit b5755d8

Please sign in to comment.