سؤال

I created a custom grid header renderer (subclass of GridItemRenderer, spark). In it, I have a button that I want hidden or shown, based on a flag coming from outside the grid and not part of the dataprovider. Whats the best way send the message to hide or show it? This is more of a design question I guess. I obviously cant use messages using IOC framework like parsley as it is an itemrenderer. Is creating a singleton to manage the button's visibility state the only way? I was thinking if there is a way to just expose the button from the skin like how the skinnablecontainer works and from there I can manage it more easily.

هل كانت مفيدة؟

المحلول 2

workaround i used is to use a singleton. hacky but works for me.

نصائح أخرى

In your itemrenderer...make one setter for visible the button or not.....

[Bindable]
private var _isBtnVisible:Boolean;

public function set isBtnVisible(value:Boolean):void
{
_isBtnVisible = value;
}

<s:Button visible="{_isBtnVisible}" />

and then set "isBtnVisible" variable from datagrid...

<s:DataGrid isBtnVisible={obj.visible} />

try this....hope it will help you....

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top