flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark goldin <markzolo...@gmail.com>
Subject Re: Flex - Disable an item with checkbox in List
Date Fri, 17 Jun 2016 17:53:48 GMT
That should work. But I have done it differently.

Here is a custom List component:
<?xml version="1.0" encoding="utf-8"?>
<mx:List xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.listClasses.IListItemRenderer;
override protected function drawItem(item:IListItemRenderer,
selected:Boolean=false, highlighted:Boolean=false,
caret:Boolean=false, transition:Boolean=false):void
{
item.enabled = item.data.enabled;
super.drawItem(item, selected, highlighted && item.enabled, caret,
transition);
}
]]>
</mx:Script>
</mx:List>

Credit to an article on the Web.

On Fri, Jun 17, 2016 at 12:46 PM Alex Harui <aharui@adobe.com> wrote:

> Maybe this?
> http://blogs.adobe.com/aharui/2007/06/disabling_list_selection.html
>
> On 6/17/16, 9:11 AM, "mark goldin" <markzolotoy@gmail.com> wrote:
>
> >I have a List with checkboxes. I wan to disable some items based on List's
> >data.
> >
> >Here is my List:
> >
> ><mx:List id="templateList" width="100%" alternatingItemColors="[#EEEEEE,
> >white]"
> >labelField="Name" selectedIndex="0">
> ><mx:itemRenderer>
> ><mx:Component>
> ><templateFilterCheckBox/>
> ></mx:Component>
> ></mx:itemRenderer>
> ></mx:List>
> >
> ><?xml version="1.0" encoding="utf-8"?>
> ><mx:CheckBox selectedField="isSelected" change="onChange(event)"
> >enabled="{data.enabled}"
> >xmlns:mx="http://www.adobe.com/2006/mxml">
> ><mx:Script>
> ><![CDATA[
> >private function onChange(event:Event):void
> >{
> >data.isSelected = !data.isSelected;
> >var _changeComplete:Event = new Event("filterChangeComplete", true);
> >dispatchEvent(_changeComplete);
> >}
> >]]>
> ></mx:Script>
> ></mx:CheckBox>
> >
> >I have set data.enabled to false for all items just for testing. None of
> >checkboxes come out disabled. The data provider is an AraayCollection and
> >bindable.
> >Any idea what is missed?
> >
> >Thanks
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message