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

      0  

    Default AsyncCallback creation of Accordion contents not displayed

    AsyncCallback creation of Accordion contents not displayed


    It seems that when I populate the contents of an Accordion panel they are not displayed until I do a window resize.

    eg:
    I load a set of categories from a database and create a Panel for each of them.
    The panels are added to the Accordion window.
    Each panel (aka category) contains a grid of items.
    The grid is not displayed unless I do a Window resize.

    If I hard-code the call of the function that fills the grid, it displays ok.
    If I call the function that fills the grid from the onSuccess function of a AsyncCallback the grid is not displayed.

    I have tried overriding the onRender, onClick and other events.
    I have also tried changing the width of the grid, making the store listen for changes. No good.
    I have also tried using a tree instead of a grid, same result.
    I then tried putting a button in the panel, same result - not displayed until I do a window resize.

    I'm using GWT 1.5.3, gxt-1.2.1

    Any help is greatly appreciated.
    Sean

    Code:
    public class NichePanel extends ContentPanel {
    
        AManagerServiceAsync aManagerService;
        String previousCategory;
        Grid<NicheModel> selectedGrid;
    
        public NichePanel() {
            setHeading("Niches");
            setIconStyle("icon-niches");
            setLayout(new AccordionLayout());
    
            buildUI();
            loadCategories();
        }
    ...
        private void loadCategories() {
            //if (1 == 1) {
            // this works just fine
            //loadNiche(new NicheModel(1L, "first", "cat one", Status.RUNNING));
            //return;
            //}
    
            // this displays empty panels until the window is resized
            aManagerService = AManagerService.App.getInstance();
            aManagerService.getNiches(new AsyncCallback<List<NicheModel>>() {
                public void onFailure(Throwable caught) {
                    ClientLogger.logWarn(this, caught.toString());
                }
    
                public void onSuccess(List<NicheModel> nicheList) {
                    Collections.sort(nicheList, new NicheModelComparator());
                    for (NicheModel niche : nicheList)
                        loadNiche(niche);
                }
            });
        }
    
        private void loadNiche(NicheModel niche) {
            if (!niche.get(Column.CATEGORY).equals(previousCategory)) {
                previousCategory = (String) niche.get(Column.CATEGORY);
    
                ContentPanel cp = new ContentPanel();
                cp.setHeading((String) niche.get(Column.CATEGORY));
                cp.setLayout(new FitLayout());
    
                selectedGrid = createGrid();
                cp.add(selectedGrid);
                cp.show();
                add(cp);
            }
    
            selectedGrid.getStore().insert(niche, 0);
            selectedGrid.getStore().commitChanges();
        }

  2. #2
    Ext User
    Join Date
    Feb 2009
    Posts
    14
    Vote Rating
    0
    Datagenn is on a distinguished road

      0  

    Default


    This issue also exists in gxt 1.2.3.
    I downloaded 1.2.3, did a clean-all in Eclipse, replaced the jar file, did a new build, same results.

  3. #3
    Ext User
    Join Date
    Feb 2009
    Posts
    14
    Vote Rating
    0
    Datagenn is on a distinguished road

      0  

    Default


    I've also tried:
    selectedGrid.getStore().add(niche);

    with and without
    selectedGrid.getStore().commitChanges();

    No change.

  4. #4
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    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


    Moved to help forum. set layoutonchange to true or call layout.

  5. #5
    Ext User
    Join Date
    Feb 2009
    Posts
    14
    Vote Rating
    0
    Datagenn is on a distinguished road

      0  

    Default


    Hey that works!
    Thank you, I spent just under 6 hours on this one without a solution..

    Im a happy guy now

Thread Participants: 1