Focal Point
[SOLVED by case] question about linking/nesting flex enable controls

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1417034406

May 25, 2011, 06:02 PM
Joy_Jacques
[SOLVED by case] question about linking/nesting flex enable controls
Hi all,

I'm using Flash Builder and Flex Enable to create a dashboard.

I have a fex data source the I'm bringing into a datagrid. The datagrid has three columns: Segment, Application and Product. This is a hierarchy. Choose a particular Segment and you get certain items in Application, choose an Application and you get certain products.

I have three ibicomboboxes, one for each column. cbSegment (the top of the hierarchy) points to the datagrid as the ibiParent and displays Segment only, cbApplication is also pointed to the datagrid with ibiParent, but also has cbSegment as the ibiFilterParent. These two controls work fine. You change the segment and the items in application are changed.

My problem is with the third combobox, cbProducts. It also points to the datagrid as ibiParent, and has cbApplication as the ibiFilterParent. This control filters properly IF you make a change to cbApplication, but on load of the application, and when you change cbSegment the cbProduct shows ALL the items for the SEGMENT, not filtered by Application.

http://tinypic.com/view.php?pic=sn02h1&s=7

Here's a screenshot that might make it more clear. You can see that the cbProduct which should ONLY be listing 2-Wheel Tractors, is listing ALL Products for that segment.

Here's my code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1000" minHeight="540" height="540" maxHeight="540" maxWidth="1000" width="1000" xmlns:ibi="http://www.informationbuilders.com">
	<ibi:ibiCanvas left="0" top="0" bottom="0" right="0" id="mainCanvas" backgroundColor="#FFFFFF">
		<mx:TabNavigator top="10" left="10" bottom="0" right="0" id="mainTabNavigator" backgroundColor="#a0a0a0" dropShadowEnabled="true" shadowDistance="4">
			<mx:Canvas label="OEM Data" width="100%" height="100%" id="tabOEMData">
				<ibi:ibiDataGrid x="31" y="158" width="702" id="mainDataGrid" visible="true" ibiGroupBy="SEGMENT,APPLICATION,PRODUCT" ibiUseColumns="SEGMENT,APPLICATION,PRODUCT" ibiUseFiltered="true" height="323">
					<ibi:seturl><![CDATA[https:url to fex]]></ibi:seturl>
				</ibi:ibiDataGrid>
				<ibi:ibiComboBox x="10" y="25" ibiParent="mainDataGrid" ibiUseColumns="SEGMENT" ibiGroupBy="SEGMENT" ibiColumn="SEGMENT" ibiFilterShowALL="false" id="cbSegment" ibiFilterAble="true" width="180"/>
				<ibi:ibiComboBox x="206" y="25" ibiParent="mainDataGrid" ibiUseColumns="APPLICATION" ibiGroupBy="APPLICATION" ibiColumn="APPLICATION" ibiFilterShowALL="false" id="cbApplication" ibiFilterParent="cbSegment" ibiFilterAble="true" width="210" ibiFilterCond="EQ" ibiUseFiltered="true"/>
				<ibi:ibiComboBox x="430" y="25" ibiParent="mainDataGrid" ibiUseColumns="PRODUCT" ibiGroupBy="PRODUCT" ibiColumn="PRODUCT" ibiFilterShowALL="false" id="cbProduct" ibiFilterParent="cbApplication" width="210" ibiFilterCond="EQ" ibiFilterAble="true" ibiUseFiltered="true"/>
				<mx:Label x="51" y="6" text="Segment"/>
				<mx:Label x="244" y="6" text="Application"/>
				<mx:Label x="457" y="6" text="Product"/>
			</mx:Canvas>
			<mx:Canvas label="Regional Data" width="100%" height="100%">
			</mx:Canvas>
			<mx:Canvas label="Trends" width="100%" height="100%">
			</mx:Canvas>
		</mx:TabNavigator>
	</ibi:ibiCanvas>
	
</mx:Application>

  

Thanks for any help.

This message has been edited. Last edited by: Kerry,


7.7.2, Windows, html
May 26, 2011, 10:15 AM
Gizmo
Try setting the ibiFilterDefault for each of the combo boxes. Second, for Segment, set the ibiFilterSibling to Application and for Product, set it to Segment.



Windows: WF 7.6.2: SQL Server 2008 R2
May 26, 2011, 10:47 AM
Joy_Jacques
What should I set ibiFilterDefault to?

Leaving ibiFilterDefault blank I tried setting the ibiFilter siblings as you said and the application crashes.

Thanks for your help.


7.7.2, Windows, html
May 26, 2011, 03:00 PM
Joy_Jacques
I was incorrect in my first post, both the second and third combobox controls list ALL items in Segment. They only filter when you make a selection from the upstream control. Example: on load Segment lists all segment items (as it should), Application lists All application items in ALL Segments (not what I want) and Product lists ALL Product item for ALL Segments.

If you change Segment, Application correctly lists application items for ONLY that segment. Product changes to show the first item in the Application list, but when you click the pulldown it is showing ALL items in the selected Segment.

I have tried using the various ibiFilter options with no success. I could use some actionscript code, but it seems like these controls SHOULD be able to be chained natively, without writing code. Maybe that's wrong...


7.7.2, Windows, html
May 27, 2011, 09:56 AM
Gizmo
ibiFilterDefault would be used to set the default filter for the combo box - eg ENGLAND if you wanted ENGLAND to be the default country when it opened. If you are not interested in using the ibiFilterDefault, then make sure the attribute is not set as part of the ibiComboBox.

Where you are wanting to nest the filters (chained), then you would want to use ibiFilterParent instead of ibiFilterSibling.

Here is an example.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600" 
				xmlns:ibi="http://www.informationbuilders.com"
				applicationComplete="init()">
	
	<mx:Script>
		<![CDATA[
			[Bindable]
			public var fex:String;
			
			public function init():void
			{
				fex = "TABLE FILE CAR SUM SALES BY COUNTRY BY CAR BY MODEL\n";
				fex += "ON TABLE PCHOLD FORMAT XML\n";
				fex += "END\n";
				fex = encodeURI(fex);
			}
		]]>
	</mx:Script>
	<ibi:ibiCanvas width="887" height="559">
		<ibi:ibiDataGrid id="CARDATA" seturl="http://localhost/ibi_apps/WFServlet?IBIF_adhocfex={fex}" x="44" y="72"/>
		<ibi:ibiComboBox x="44" y="42" id="cmbCountry" ibiParent="CARDATA" ibiColumn="COUNTRY" ibiFilterAble="true"/>
		<ibi:ibiComboBox x="212" y="42" id="cmbCar" ibiParent="CARDATA" ibiColumn="CAR" ibiFilterAble="true" ibiFilterParent="cmbCountry"/>
		<ibi:ibiComboBox x="380" y="42" id="cmbModel" ibiParent="CARDATA" ibiColumn="MODEL" ibiFilterAble="true" ibiFilterParent="cmbCar"/>
	</ibi:ibiCanvas>
</mx:Application>




Windows: WF 7.6.2: SQL Server 2008 R2
June 01, 2011, 05:24 PM
Joy_Jacques
Received this code from IBI and this solves my issue.

If you wait for the data to finish loading using ibiDataEvent listener, then call doFilter method on the parent combo box, the filter should be properly applied to the nested combo box children because now it will wait for everything to be ready to apply the filter. The following is the sample code. You need to call this init function in creationComplete property on mx:Application.

private var initialFilterSet:Boolean = false;

private function init():void
{
this.addEventListener(ibiDataEvent.DATA_LOADED, ibiDataLoadedHandler);
}

private function ibiDataLoadedHandler(e:ibiDataEvent):void
{
if( e.componentID == 'mainDataGrid' ){
/*
Prevent endless looping by checking initialFilterSet variable.

*/
if( !initialFilterSet ){
initialFilterSet = true;
mainCanvas.doFilter('cbSegment');
mainCanvas.doFilter('cbApplication');
}
}
}

With this code my comboboxes now filter correctly. This is something that is supposed to be fixed in a later version of Flex Enable, but this workaround solves the problem until it's fixed.


7.7.2, Windows, html