Good evening,
I have two list boxes with data in them.
One filters the other based on the users click, however now I need to
filter it based on a multiselection from one list box and filter the
other list box. Any ideas on how I can handle the multiselection
from the list box within my applyFilter function?
***************filter code********************
//Function that filters a list/grid contents based on a selection
from another component (like type search/match)
private function applyFilter(item:Object):Boolean {
var result:Boolean=false;
//check to see if the category datagrid is selected or not
if (lstBusUnitDP.selectedIndex != -1) {
if (item.fk_bu_ID == lstBusUnitDP.selectedItem.bu_ID){
trace('onchange');
result = true;
}
} else {
//returns back all the objects in the array, the user clicked
the refresh button.
result = true;
}
return result;
}
private function divisionFilter():void {
//refresh the ArrayCollection to apply the filter
divisionsDP.filterFunction = applyFilter;
divisionsDP.refresh();
lstDivisionDP.selectedIndex = -1;
}
**************listbox code (two)********************
<mx:HBox width="100%" height="115" id="hboxCustomer" visible="true"
enabled="false">
<mx:HBox width="50%">
<mx:Label id="lblBusUnit" text="Business Unit:" />
<mx:List id="lstBusUnitDP" height="100" width="100%"
allowMultipleSelection="true"
dataProvider="{busUnitsDP}" labelField="bu_name"
change="divisionFilter()"
toolTip="You choose multiple selections by holding
down the CTRL key and left clicking">
</mx:List><!--dummy data at the moment-->
</mx:HBox>
<mx:HBox width="48%">
<mx:Label id="lblDivision" text="Division:"/>
<mx:List id="lstDivisionDP" height="100" width="100%"
allowMultipleSelection="true"
dataProvider="{divisionsDP}" labelField="div_name"
toolTip="You choose multiple selections by holding
down the CTRL key and left clicking">
</mx:List><!--dummy data at the moment-->
</mx:HBox>
</mx:HBox>