On 1/5/17, 2:53 AM, "sankar" <santanu4...@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