Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:jiraissueservice1="services.jiraissueservice1.*">

    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            import mx.events.FlexEvent;
            import mx.events.ListEvent;
            import mx.rpc.events.ResultEvent;

            import services.ServiceManager;

            import spark.events.IndexChangeEvent;

            //[Bindable]public var SelectOption:ArrayCollection = new ArrayCollection([
                //{label:"pKey", data:1},
                //{label:"PROJECT", data:2},
                //{label:"CREATED", data:3},
                //{label:"DEFECTTYPE", data:4},
                //{label:"REPORTER", data:5},
                //{label:"ASSIGNEE", data:6},
                //{label:"SLA",  data:7}]);



            // Array for Population "Select Option" ComboBox
            [Bindable] public var ArrColl_selectOptionComboBox:ArrayCollection = new ArrayCollection;
            [Bindable] public var SelectOption:ArrayCollection = new ArrayCollection;

            [Bindable] public var mainArrColl:ArrayCollection = new ArrayCollection;
            [Bindable] public var DGDataProvider:ArrayCollection = new ArrayCollection;
            [Bindable] public var myDataProvider:Array = new Array;

            public function clear():void
            {
                DGDataProvider = new ArrayCollection;
            }

            //clicking on the Get Data button to retrieve from the Jiraissue
            protected function button_clickHandler(event:MouseEvent):void
            {
                getAllJiraissueResult2.token = jiraissueService1.getAllJiraissue();


            }

            protected function getAllJiraissueResult2_resultHandler(event:ResultEvent):void
            {
                mainArrColl = getAllJiraissueResult2.lastResult as ArrayCollection;
                DGDataProvider = mainArrColl;




    }


            //var myDataProvider:Array = [];






        protected function Combobox_Option_changeHandler(event:ListEvent):void
            {

                    myLabel.text = "You selected: " +  ComboBox(event.target).selectedItem.label;

                        //Value.prompt="Select Value";
                        //Value.selectedIndex=-1; // reset so prompt shows


            }



            ]]>

    </fx:Script>

    <fx:Declarations>
        <jiraissueservice1:JiraissueService1 id="jiraissueService1" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <s:CallResponder id="getAllJiraissueResult2" result="getAllJiraissueResult2_resultHandler(event)"/>

        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Button x="59" y="49" label="GET DATA"  id="button" click="button_clickHandler(event)"/>
    <mx:DataGrid x="60" y="299" width="800" id="dataGrid" dataProvider="{DGDataProvider}">
        <mx:columns>

            <mx:DataGridColumn headerText="pkey" dataField="pkey"/>
            <mx:DataGridColumn headerText="PROJECT" dataField="pname"/>
            <mx:DataGridColumn headerText="CREATED" dataField="CREATED"/>
            <mx:DataGridColumn headerText="defectType" dataField="stringvalue"/>
            <mx:DataGridColumn headerText="Reporter" dataField="REPORTER"/>
            <mx:DataGridColumn headerText="ASSIGNEE" dataField="ASSIGNEE"/>
            <mx:DataGridColumn headerText="SLA" dataField="SLA"/>

        </mx:columns>
    </mx:DataGrid>


    <s:Button x="214" y="49" label="RESET" click="clear()"/>
    <s:Button x="557" y="168" label="Button"/>

    <mx:ComboBox id="Combobox_Option" width="201"   dataProvider="{SelectOption}" labelField="label"
                    prompt="Select Option" change="Combobox_Option_changeHandler(event)"
                     x="59" y="169"/>
    <mx:ComboBox id="Value" width="201"  labelField="label"
                    prompt="Select Value"
                     x="308" y="169"/>
    <s:Label id="myLabel" text="You selected:" fontWeight="bold" x="59" y="275"/>


</s:Application>



CSS
This is my code so far,where I have populated the datagrid through a service call.
I want to have 2 combobox.
1. Combobox one : want to populate the name of all the columns of the datagrid dynamically.
2. Combobox 2 : on clicking the name of the column in the 1st combobox , I want to filter the unique values for that column

example : If I select "Project" in 1st combobox --- values of project such as "Amway" , "Dentsply" etc should show in the 2nd combobox
Posted
Updated 14-Feb-13 0:06am
v2
Comments
Sandeep Mewara 13-Feb-13 10:13am    
And the issue... ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900