Yishay had some code to handle the cases where it’s not set via MXML which you
removed.
I changed his code to simply intialize the document if it was not set by MXML
like this:
//Needed if the layout is not declared using MXML
private function
initializeDocument(contentView:ILayoutView):void
{
document = {};
for (var i:int = 0; i < contentView.numElements; i++)
{
var child:IStyleableObject =
contentView.getElementAt(i) as IStyleableObject;
document[child.id] = child;
}
}
and in layout():
if(document == null)
initializeDocument(contentView);
An AccordionLayout might make sense though. And switching to selection rather
than checking collapsed might make sense as well.
Thanks for working on this.
> On May 31, 2017, at 7:47 PM, Peter Ent <[email protected]> wrote:
>
> I'm still working on this and ran into a couple of issues.
>
> The flexible child layouts no longer provide a way to explicitly set a
> child; instead they rely in the child's id being used to retrieve the
> child from the document. Unfortunately, a layout that is not referenced in
> MXML will not get its document set.
>
> Perhaps a better solution is to write "AccordionLayout" that will expand
> the child selected by the model, but I'm still looking at making use of
> what is already there.
>
> —peter
>
>
>
> On 5/30/17, 11:35 AM, "Harbs" <[email protected]> wrote:
>
>> The reasons it’s broken is (at least) thee-fold:
>>
>> 1. Panels contain content and need to be collapsed despite the fact that
>> content exists.
>> 2. The Collapse bead can only infer that it’s collapsed by the fact that
>> the size is the collapsed size — which only makes sense if the size is
>> set.
>> 3. The title must be measured to set the collapsed height correctly.
>>
>>> On May 30, 2017, at 6:21 PM, Harbs <[email protected]> wrote:
>>>
>>> Something like this:
>>>
>>> <js:Accordion selectedIndex="0">
>>> <js:dataProvider>
>>> <fx:Array>
>>> <js:Panel id="panel1" title="Panel 1"/>
>>> <js:Panel id="panl2" title="Panel 2"/>
>>> </fx:Array>
>>> </js:dataProvider>
>>> </js:Accordion>
>>>
>>> This is the markup of an Accordion which used to work, which doesn’t
>>> anymore.
>>>
>>> <js:Accordion id="accordion" width="100%" height="100%">
>>> <js:dataProvider>
>>> <fx:Array>
>>> <view:SetupPanel/>
>>> <view:PackagePanel/>
>>> <view:TemplatePanel/>
>>> <view:FontPanel/>
>>> </fx:Array>
>>> </js:dataProvider>
>>> </js:Accordion>
>>>
>>>
>>>> On May 30, 2017, at 4:54 PM, Peter Ent <[email protected]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Do you have a quick example of how to use the FlexJS Accordion? The
>>>> ASDoc
>>>> on it is thin. The children of the Flex SDK Accordion were navigation
>>>> components that supported things like title so each section could be
>>>> labeled. I don't see an AccordionChild or something similar that can be
>>>> used with Accordion. I took a guess and made Container a child of it,
>>>> but
>>>> it just blew up.
>>>>
>>>> Thanks,
>>>> ‹peter
>>>>
>>>> On 5/30/17, 6:39 AM, "Harbs" <[email protected]> wrote:
>>>>
>>>>> It seems like the new layouts totally broke Accordion.
>>>>>
>>>>> Accordion relied on absolute sizing to handle expanding and
>>>>> collapsing of
>>>>> content. I tried to add a new layout which is basically a copy of the
>>>>> old
>>>>> OneFlexibleVerticalLayout and use that for accordion, but that does
>>>>> not
>>>>> seem to work either due to changes in containers (I think).
>>>>>
>>>>> Peter, do you thin you could look into this?
>>>>>
>>>>> Thanks,
>>>>> Harbs
>>>>
>>>
>>
>