Advertisement

07.22.2008 at 04:16PM PDT, ID: 23586912
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.7

My DataGrid isnt populating when i add a search button.

Asked by thawts in Adobe Flex

Tags: ,

K so i have an advanced datagrid that is working fine using this the code below and importing the xml (i listed the xml after the code)  After this example you will see my new code that is adding a search button.  I dont get any errors when running it but i get a warning and the datagrid is not being populated.

The warning says:
Data binding will not be able to detect assignments to "myAC".      
Its on line 62 and i will add a little <!-- Here is the warning --> in the new code located at the bottom.


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<!-- Code working without search button -->
<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="myHS.send() " >
<mx:HTTPService id="myHS" url="data.xml" result="myAC = myHS.lastResult.results.row as ArrayCollection"/>
<mx:Script>
  <![CDATA[
    import mx.collections.ArrayCollection;
    [Bindable]
    private var myAC:ArrayCollection;
  ]]>
</mx:Script>


<mx:Panel width="612" height="456" layout="absolute" horizontalCenter="0" verticalCenter="-18" resizeEffect="Resize" title="Top 25 Report">


<mx:AdvancedDataGrid id="myADG" dataProvider="{myAC}" width="542" variableRowHeight="true" wordWrap="true" height="422" horizontalCenter="0" verticalCenter="2">
  <mx:columns>
    <mx:AdvancedDataGridColumn headerText="ID" dataField="DIST_ID" styleFunction="highlightCost"/>
    <mx:AdvancedDataGridColumn headerText="ROMAN NAME 1" dataField="ROMAN_NAME_1"/>
    <mx:AdvancedDataGridColumn headerText="ROMAN NAME 2" dataField="ROMAN_NAME_2" />
  </mx:columns>
</mx:AdvancedDataGrid>

</mx:Panel>      
      
      <mx:Script>
        <![CDATA[

        public function highlightCost(data:Object, column:AdvancedDataGridColumn):Object
        {
            if (data.DIST_ID > 3000)
                return { color : "blue" };
            else
                return null;
        }

        ]]>
    </mx:Script>
</mx:Application>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The xml file looks like this
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<?xml version="1.0" encoding="ISO-8859-1"?>

<results>

  <row>

    <DIST_ID>104831</DIST_ID>

    <ROMAN_NAME_1>Doerrier, David</ROMAN_NAME_1>

    <ROMAN_NAME_2>null</ROMAN_NAME_2>

  </row>

  <row>

    <DIST_ID>104832</DIST_ID>

    <ROMAN_NAME_1>Pereira Coutinho, Benjamin</ROMAN_NAME_1>

    <ROMAN_NAME_2>null</ROMAN_NAME_2>

  </row>

  <row>

    <DIST_ID>104833</DIST_ID>

    <ROMAN_NAME_1>sutton, David A</ROMAN_NAME_1>

    <ROMAN_NAME_2>null</ROMAN_NAME_2>

  </row>

  <row>

    <DIST_ID>104834</DIST_ID>

    <ROMAN_NAME_1>Berdin, Frian Joy Y</ROMAN_NAME_1>

    <ROMAN_NAME_2>null</ROMAN_NAME_2>

  </row>

  <row>

    <DIST_ID>104835</DIST_ID>

    <ROMAN_NAME_1>Good Health Maui Inc</ROMAN_NAME_1>

    <ROMAN_NAME_2>null</ROMAN_NAME_2>

  </row>

</results>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
new code with search button
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="myHS.send() " >
<mx:HTTPService id="myHS" url="data.xml" result="myAC = myHS.lastResult.results.row as ArrayCollection"/>
<mx:Script>
      <![CDATA[
            import mx.collections.SortField;
            import mx.collections.Sort;
            import mx.collections.IViewCursor;
            import mx.events.FlexEvent;
            import mx.collections.ArrayCollection;
            import mx.rpc.events.ResultEvent;
            
            [Bindable]
            
            private var cursor:IViewCursor;
            private var myAC:ArrayCollection;
            
            private function initApp():void
                  {
                  this.myHS.send();
                  }
                  
            private function onResult(evt:ResultEvent):void
                  {
                        var sort:Sort = new Sort();
                        sort.fields = [ new SortField("ID",true) ];
                        this.myAC = evt.result.data.region;
                        this.myAC.sort = sort;
                        this.myAC.refresh();
                        this.cursor = this.myAC.createCursor();
                  }
                  
            private function searchID():void
                  {
                        if(search_ti.text != "")
                              {
                                    if(this.cursor.findFirst({ID:search_ti.text})){
                                          var idx:int = this.myAC.getItemIndex(this.cursor.current);
                                          this.myADG.scrollToIndex(idx);
                                          this.myADG.selectedItem = this.cursor.current;
                                    
                              
                  
                                    }
                              }
                  }
      ]]>
</mx:Script>
<mx:Form x="0" y="165">
            <mx:FormItem label="Search">
                  <mx:TextInput id="search_ti"/>
            </mx:FormItem>
                  <mx:FormItem>
                        <mx:Button label="Search ID" click="searchID()"/>
                  </mx:FormItem>
      </mx:Form>
      
<mx:Panel width="612" height="456" layout="absolute" horizontalCenter="0" verticalCenter="-18" resizeEffect="Resize" title="Top 25 Report">


<!--Here is where the warning is--><mx:AdvancedDataGrid id="myADG" dataProvider="{myAC}" width="542" variableRowHeight="true" wordWrap="true" height="422" horizontalCenter="0" verticalCenter="2">
  <mx:columns>
    <mx:AdvancedDataGridColumn headerText="ID" dataField="DIST_ID" styleFunction="highlightID"/>
    <mx:AdvancedDataGridColumn headerText="ROMAN NAME 1" dataField="ROMAN_NAME_1"/>
    <mx:AdvancedDataGridColumn headerText="ROMAN NAME 2" dataField="ROMAN_NAME_2" />
  </mx:columns>
</mx:AdvancedDataGrid>
      
</mx:Panel>





      <mx:Script>
        <![CDATA[

        public function highlightID(data:Object, column:AdvancedDataGridColumn):Object
        {
            if (data.DIST_ID > 3000)
                return { color : "blue" };
            else
                return null;
        }

        ]]>
    </mx:Script>
</mx:Application>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Please Help!!!!Start Free Trial
[+][-]07.22.2008 at 11:17PM PDT, ID: 22066462

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 09:42AM PDT, ID: 22071106

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 10:23AM PDT, ID: 22071604

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 11:32AM PDT, ID: 22072363

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 11:12PM PDT, ID: 22076430

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 09:40AM PDT, ID: 22090153

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 09:41AM PDT, ID: 22090160

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 11:08AM PDT, ID: 22090930

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.27.2008 at 11:27PM PDT, ID: 22100983

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Adobe Flex
Tags: Adobe Flex 3, Adobe Flex 3
Sign Up Now!
Solution Provided By: hobbit72
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628