Hybrid View

  1. #1
    Ext User
    Join Date
    Feb 2009
    Posts
    29
    Vote Rating
    0
    cri1258 is on a distinguished road

      0  

    Default [1.2.3] Hidden TreeTable Doesn't Refresh

    [1.2.3] Hidden TreeTable Doesn't Refresh


    Env:
    GWT 1.5.3
    GXT 1.2.3
    Hosted Mode
    IE7

    If the container of a TreeTable is initially hidden using hide(), if show() is invoked on the container after the app is rendered, the contents of the TreeTable will not be displayed. Resizing the browser causes the contents to be displayed. To reproduce:

    (1) Substitute the contents of the GXT Examples class com.extjs.gxt.samples.client.examples.tree.TreeTableExample.java with the following code:

    Code:
    * Ext GWT - Ext for GWT
     * Copyright(c) 2007, 2008, Ext JS, LLC.
     * licensing@extjs.com
     * 
     * http://extjs.com/license
     */
    package com.extjs.gxt.samples.client.examples.tree;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import com.extjs.gxt.samples.client.Examples;
    import com.extjs.gxt.samples.client.FileServiceAsync;
    import com.extjs.gxt.samples.client.examples.model.FileModel;
    import com.extjs.gxt.samples.client.examples.model.FolderModel;
    import com.extjs.gxt.ui.client.Registry;
    import com.extjs.gxt.ui.client.binder.TreeTableBinder;
    import com.extjs.gxt.ui.client.data.BaseTreeLoader;
    import com.extjs.gxt.ui.client.data.ModelData;
    import com.extjs.gxt.ui.client.data.RpcProxy;
    import com.extjs.gxt.ui.client.data.TreeLoader;
    import com.extjs.gxt.ui.client.event.ComponentEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.store.Store;
    import com.extjs.gxt.ui.client.store.StoreSorter;
    import com.extjs.gxt.ui.client.store.TreeStore;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.LayoutContainer;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.button.ButtonBar;
    import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
    import com.extjs.gxt.ui.client.widget.table.DateTimeCellRenderer;
    import com.extjs.gxt.ui.client.widget.treetable.TreeTable;
    import com.extjs.gxt.ui.client.widget.treetable.TreeTableColumn;
    import com.extjs.gxt.ui.client.widget.treetable.TreeTableColumnModel;
    import com.google.gwt.i18n.client.DateTimeFormat;
    import com.google.gwt.user.client.Element;
    import com.google.gwt.user.client.rpc.AsyncCallback;
    
    public class TreeTableExample extends LayoutContainer {
      @Override
      protected void onRender(Element parent, int pos) {
        super.onRender(parent, pos);
    
        setLayout(new FlowLayout(10));
        final ContentPanel treeContainer = new ContentPanel();
        final FileServiceAsync service = (FileServiceAsync) Registry.get(Examples.FILE_SERVICE);
        
        List<TreeTableColumn> columns = new ArrayList<TreeTableColumn>();
        TreeTableColumn column = new TreeTableColumn("name", "Name", 300);
        column.setMinWidth(75);
        columns.add(column);
        column = new TreeTableColumn("date", "Date", 170);
        column.setRenderer(new DateTimeCellRenderer(DateTimeFormat.getMediumDateTimeFormat()));
        columns.add(column);
        column = new TreeTableColumn("size", "Size", 120);
        columns.add(column);
    
        TreeTableColumnModel cm = new TreeTableColumnModel(columns);
    
        final TreeTable table = new TreeTable(cm);
        table.setAnimate(false);
        table.getStyle().setLeafIconStyle("icon-page");
    
        // data proxy
        RpcProxy<FileModel, List<FileModel>> proxy = new RpcProxy<FileModel, List<FileModel>>() {
          @Override
          protected void load(FileModel loadConfig, AsyncCallback<List<FileModel>> callback) {
            service.getFolderChildren(loadConfig, callback);
          }
        };
    
        // tree loader
        final TreeLoader loader = new BaseTreeLoader(proxy) {
          @Override
          public boolean hasChildren(ModelData parent) {
            return parent instanceof FolderModel;
          }
        };
    
        // trees store
        final TreeStore<FileModel> store = new TreeStore<FileModel>(loader);
        store.setStoreSorter(new StoreSorter<FileModel>() {
    
          @Override
          public int compare(Store store, FileModel m1, FileModel m2, String property) {
            boolean m1Folder = m1 instanceof FolderModel;
            boolean m2Folder = m2 instanceof FolderModel;
    
            if (m1Folder && !m2Folder) {
              return -1;
            } else if (!m1Folder && m2Folder) {
              return 1;
            }
    
            return super.compare(store, m1, m2, property);
          }
        });
    
        final TreeTableBinder<FileModel> binder = new TreeTableBinder<FileModel>(table, store);
        binder.setDisplayProperty("name");
    
        loader.load(null);
    
        table.setSize(700, 300);
    
        addText("<div style='font-size: 12px;padding-bottom: 8px'>TreeTable example using a TreeStore with a TreeLoader using RCP.</div>");
        treeContainer.add(table);
        treeContainer.hide();
        add(treeContainer);
    
        ButtonBar buttonBar = new ButtonBar();
        buttonBar.add(new Button("Hide", new SelectionListener<ComponentEvent>() {
          public void componentSelected(ComponentEvent ce) {
            treeContainer.hide();
          }
    
        }));
    
        buttonBar.add(new Button("Show", new SelectionListener<ComponentEvent>() {
          public void componentSelected(ComponentEvent ce) {
            treeContainer.show();
          }
        }));
    
        add(buttonBar);
      }
    }
    (2) Bring up the modified TreeTable example and press the "Show" button. Note that the contents of the table are not displayed.

    (3) Resize the hosted mode browser windows. The contents will appear.

    I've been struggling with this problem for at least 12hrs hours now. A work around would be to somehow simulate in code the same thing that happens when the user re-sizes the browser, but I haven't been able to determine how to do this? I would be very appreciative of any suggestions! Thanks

    Chuck

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Call layout on the container. Moved to help forum.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar