1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    Russian federation, Smolensk
    Posts
    38
    Answers
    5
    Vote Rating
    0
    Mike_javaJunior is on a distinguished road

      0  

    Default Answered: Why can't see a new item in content panel

    Answered: Why can't see a new item in content panel


    I'm trying to add a new item to the content panel but can't
    Code:
    class NavigationPanel extends ContentPanel {    private final TreeStore<ModelData> treeStore = new TreeStore<ModelData>();
    
    
        NavigationPanel() {
            final TreePanel<ModelData> tree=new TreePanel<ModelData>(treeStore);tree.setDisplayProperty("name");
    
    
            treeStore.add(newNavigationItem("Search", new AppEvent(AppEvents.ShowSearchPanel)), false);
            treeStore.add(newNavigationItem("Management", new AppEvent(AppEvents.ShowManagementPanel)), false);
            treeStore.add(newNavigationItem("Logout", new AppEvent(AppEvents.ShowLoginDialog)), false);
            treeStore.add(newNavigationItem("Query", new AppEvent(AppEvents.ShowQueryPanel)), false);
    
    
            final SelectionChangedListener<ModelData> selectionListener = new SelectionChangedListener<ModelData>() {
                public void selectionChanged(final SelectionChangedEvent<ModelData> event) {
                    final AppEvent appEvent = event.getSelectedItem().<AppEvent>get("event");
                    Dispatcher.forwardEvent(appEvent);
                }
            };
            tree.getSelectionModel().addSelectionChangedListener(selectionListener);
    
    
            setHeading("Navigation");
            add(tree);
        }
    
    
        private ModelData newNavigationItem(final String text, final AppEvent event) {
            final ModelData m = new BaseModelData();
            m.set("name", text);
            m.set("event", event);
    
    
            return m;
        }

  2. When a container has new items added to it, you often need to tell it to run layout again, to properly position all children. Do this by calling layout().

    This must be done because by default, layouts do not automatically change when you add new items. This is done for performance reasons - if you add 5 things, then layout would be automatically run 5 times, once for each add call. Instead, you call layout() when you are finished.

    If you know for certain that any add call can right away run layout, you can set layoutOnChange to true. This will tell the container to run layout automatically - but be careful of any performance issue that could be introduced by this.

  3. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      1  

    Default


    When a container has new items added to it, you often need to tell it to run layout again, to properly position all children. Do this by calling layout().

    This must be done because by default, layouts do not automatically change when you add new items. This is done for performance reasons - if you add 5 things, then layout would be automatically run 5 times, once for each add call. Instead, you call layout() when you are finished.

    If you know for certain that any add call can right away run layout, you can set layoutOnChange to true. This will tell the container to run layout automatically - but be careful of any performance issue that could be introduced by this.

  4. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    Russian federation, Smolensk
    Posts
    38
    Answers
    5
    Vote Rating
    0
    Mike_javaJunior is on a distinguished road

      0  

    Default


    I don't know how it happened, but now it works. I guess it's a maven problem. I've made maven packaging a couple of times and... ta-da.
    The more I work with gxt the more I wonder. I can make some changes in my progect in the evening and all work and the next morning I just do packaging of this progect and this changes don't appear

  5. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      1  

    Default


    I can promise that GXT doesn't have any code in it that changes things on the filesystem as you go along, or checks how late you've been working and decided to break things . As with any development efforts a fresh look at an issue can help, as can breaking it down to a simpler problem to solve it.

    This serves several purposes. First, you are removing any other obstacles that could be causing issues. The test case should be simpler to run, and probably faster, without extra pieces involved. And finally, you now have a simple example that you can share on the forums for others to try to run to see if they get the same bug, or if they can point out the bug in your code.

Thread Participants: 1