flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Ent <p...@adobe.com>
Subject Re: [FlexJS] Probable design to support DataGrid sorting
Date Fri, 06 Jan 2017 16:55:05 GMT
I've given this some thought and I've come up with an idea:

Create a new DataGridView that creates the pieces. Use a horizontal
Container for the column headers, placing buttons in them and then have
the DataGrid's controller (your own version) listen for clicks on those
buttons. That will signal which column to sort which can be done via
changes to your presentation model class.

By listening to changes to the presentation model the code you have
(PNDataGridColumnSorter) can sort the data and the update to the data
provider can signal new itemRenderers to be made and presented.

How does that sound?
‹peter

On 1/5/17, 11:33 AM, "Alex Harui" <aharui@adobe.com> wrote:

>
>On 1/5/17, 2:53 AM, "sankar" <santanu4ver@gmail.com> wrote:
>
>>Accessing DataGridPresentationModel from
>>DataGridButtonBarButtonItemRenderer
>>seems quite tough even though it could be a nice place to store those
>>information. 
>>
>>To get DataGridPresentationModel I'll need to access their multiple
>>parents
>>as DataGridButtonBarButtonItemRenderer.parent.parent.parent which sounds
>>bad. _strand is also private in components and some do not have them at
>>all;
>>thus _strand.getBeadByType() is not always an available feature as well.
>>
>>I'm sticking to my earlier implementation for the time being until I get
>>a
>>way to access DataGridPresentationModel in
>>DataGridButtonBarButtonItemRenderer without referring multiple parent
>>keywords. 
>>
>
>Hi Santanu,
>
>So far, no component has needed access to a parent component, so you are
>right that a new pattern needs to be invented to handle it. I would
>recommend having the view pass its host strand to the children.  So,
>because of PAYG, you would create a class called something like
>DataGridViewWithSortableColumns where the code there sets a new property
>called something like "parentStrand" on a
>DataGridButtonBarForSortableColumns class.
>
>Storing the state of the sorting in the column renderers itself doesn't
>allow for setting an initial sorting state, so at some point, that
>functionality will need to be supported.  IOW, what if you want the DG to
>show up already sorted by the 3rd column?
>
>HTH,
>-Alex
>


Mime
View raw message