Opened 10 years ago

Closed 10 years ago

#8780 closed defect (fixed)

[patch] [cla] GridContainer does not call startup() on child widgets

Reported by: Shane O'Sullivan Owned by: dante
Priority: high Milestone: 1.4
Component: Dojox Version: 1.3.0b2
Keywords: Cc:
Blocked By: Blocking:

Description

In the startup() function of dojox.layout.GridContainer?, if the 'usepref' value is true, then child widgets "startup" method is not called. This method should always be called, regardless of the value of 'usepref', otherwise many will not initialize correctly.

Attachments (1)

GridContainer_startup2.patch (719 bytes) - added by Shane O'Sullivan 10 years ago.
Patch to fix this issue

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by Shane O'Sullivan

Patch to fix this issue

comment:1 Changed 10 years ago by Adam Peller

Owner: changed from Adam Peller to dante

dup of #8698?

comment:2 Changed 10 years ago by bill

Summary: GridContainer does not call startup() on child widgets[patch] [cla] GridContainer does not call startup() on child widgets

comment:3 Changed 10 years ago by Mathevet julien

If you use an object that extends StackContainer? getChildren method return an empty array. So there are never startup. Test using an accordeonContainer. ContentPane? works because there startup by parser.

comment:4 Changed 10 years ago by bill

Shane's patch looks good to me.

I don't know what moogle's comments means. The object being used is GridContainer. GridContainer does not extend StackContainer. But if it did, getChildren() would presumably not return an empty array.

As for his comment on ContentPane, that's outdated; in 1.3 ContentPane calls startup on it's children.

comment:5 Changed 10 years ago by Mathevet julien

Sorry, I would like to say that GridContainer?.getChildren() return an empty array. So its child component aren't be started by the grid, but by the dojo parser. For eg, if you place an AccordeonContainer? inside a GridContainer?, only AccordeonPane? are started.

comment:6 Changed 10 years ago by Mathevet julien

In fact, the getChildren works before init(). After it always return an empty array. This may be due that grid container add node ? Patch given in this ticket doesn't work, but this one work #8698 But I don't find it good. May be better to fix getChildren method.

comment:7 Changed 10 years ago by Mathevet julien

May be add something like this in GridContainer:

    getChildren: function(){
        // summary:
        //      Returns array of children widgets.
        // description:
        //      Returns the widgets that are directly under this.containerNode.
        if(this.grid)return dojo.query(".gridContainerZone >", this.containerNode).map(dijit.byNode); // Widget[]
        return this.inherited(arguments);
    },

comment:8 Changed 10 years ago by bill

Oh I see... yeah seems like getChildren() should be fixed too, and as you sort-of pointed out _Container isn't setup to deal w/the case where different children have different parent nodes.

getChildren() isn't the only thing that's broken... I think every method in _Container is broken. Fixing getChildren() will fix most of them, but not hasChildren() for example.

comment:9 Changed 10 years ago by Shane O'Sullivan

I'd definitely like to see getChildren() fixed, but am not sure what should be done in the general case. Individual widgets could override getChildren() for their own special cases, like moogle suggests for GridContainer?, and hasChildren() could just use getChildren().length > 0 , so it would get the same benefit if a widget overrides it.

However, that would be a separate patch, and unrelated to this one.

comment:10 Changed 10 years ago by bill

Milestone: tbd1.4

1.3rc1 has been release; bumping remaining tickets to 1.4 (except for documentation/testing tickets)

comment:11 Changed 10 years ago by dante

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.