4 Replies Latest reply on Jan 31, 2011 11:38 PM by Jean Demonceau

    Spark Combobox crash when dataprovider is sorted

    Jean Demonceau

      Hi,

       

      Spark combobox allow you to search in the collection when writing in it and this is pretty cool.

      But when the dataprovider is sorted with a Sort object and you search something that is not in the collection, the application crash. (Sort error)

       

      Do you have a workaround for this ?

        • 1. Re: Spark Combobox crash when dataprovider is sorted
          Shongrunden Adobe Employee

          This seems to work fine for me:

           

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                         xmlns:s="library://ns.adobe.com/flex/spark"

                         creationComplete="setupSort()">

              <fx:Script>

                  <![CDATA[

                      import mx.collections.Sort;

                      import mx.collections.SortField;

                      private function setupSort():void {

                          var dataSortField:SortField = new SortField();

                          dataSortField.name = "n";

                          dataSortField.numeric = true;

                          var numericDataSort:Sort = new Sort();

                          numericDataSort.fields = [dataSortField];

                          arrColl.sort = numericDataSort;

                          arrColl.refresh();

                      }

                  ]]>

              </fx:Script>

           

              <s:ComboBox id="cb" labelField="n">

                  <s:dataProvider>

                      <s:ArrayCollection id="arrColl">

                          <fx:Object n="5" />

                          <fx:Object n="6" />

                          <fx:Object n="3" />

                          <fx:Object n="2" />

                          <fx:Object n="1" />

                          <fx:Object n="0" />

                      </s:ArrayCollection>

                  </s:dataProvider>

              </s:ComboBox>

           

          </s:Application>

           

          Can you provide a similar small example that demonstrates the issue you are seeing?

          • 2. Re: Spark Combobox crash when dataprovider is sorted
            Jean Demonceau Level 1

            Hi,

            Thank you for answering me.

            Your example crashes to.

            Write in the combobox something that is not in the dataprovider and then click anywhere in the application to close the combobox and you'll see the error.

             

            Error: Les critères de recherche doivent contenir au moins une valeur de champ de tri.

             

                at mx.collections::Sort/findItem()[E:\dev\4.x\frameworks\projects\framework\src\mx\collectio ns\Sort.as:541]

             

                at mx.collections::ListCollectionView/getItemIndex()[E:\dev\4.x\frameworks\projects\framewor k\src\mx\collections\ListCollectionView.as:652]

             

                at spark.components.supportClasses::ListBase/commitProperties()[E:\dev\4.x\frameworks\projec ts\spark\src\spark\components\supportClasses\ListBase.as:818]

             

                at spark.components::List/commitProperties()[E:\dev\4.x\frameworks\projects\spark\src\spark\ components\List.as:907]

             

                at spark.components.supportClasses::DropDownListBase/commitProperties()[E:\dev\4.x\framework s\projects\spark\src\spark\components\supportClasses\DropDownListBase.as:504]

             

                at spark.components::ComboBox/commitProperties()[E:\dev\4.x\frameworks\projects\spark\src\sp ark\components\ComboBox.as:624]

             

                at mx.core::UIComponent/validateProperties()[E:\dev\4.x\frameworks\projects\framework\src\mx \core\UIComponent.as:7933]

             

                at mx.managers::LayoutManager/validateProperties()[E:\dev\4.x\frameworks\projects\framework\ src\mx\managers\LayoutManager.as:572]

             

                at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:730]

             

                at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1072]
            • 3. Re: Spark Combobox crash when dataprovider is sorted
              Shongrunden Adobe Employee

              You're right this does fail for me in Flex 4.0.0 and 4.1.0. 

               

              It seems to work in the latest build (4.5.0.20012) so should be fixed in the next release of Flex.

               

              1 person found this helpful