5 Replies Latest reply on Sep 9, 2009 10:37 AM by kingquattro

    Paging not working

    kingquattro Level 1

      Hey guys,

           I am having major trouble getting paging to work with my datagrid.  Here is what is happing right now. 

       

      After data is send to ColdFusion CFC, "count" function is called, and returns correct result, but then the "get" function is called over and over, and data is not even displayed in my datagrid.  Here is what my code looks like

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/halo"
          xmlns:cfservice="services.*" width="100%" height="100%"
          paddingLeft="0" paddingRight="0"
          horizontalGap="0" verticalGap="0" layout="vertical"
          styleName="catalogPanel" title="Search Result"
          creationComplete="initSearchResultPanel()">

       

          <fx:Script>

                .

                .

                .

                .

               protected function initSearchResultPanel():void{
                     util.app.addEventListener(SearchDBEvent.SEARCH_DB_EVENT,searchDBRequest);

                     .

                     .

                     .

                }

       

                .

                .

                .

       

                protected function searchDBRequest(event:SearchDBEvent):void{
                      var obj:Object = event.struct;
                      var d:DataManager=SearchRPC.getDataManager(SearchRPC.DATA_MANAGER_SEARCHDBRESPONSE);
                      d.pageSize=obj.PAGESIZE;
                      getSearchRSLTResult.token = SearchRPC.getSearchRSLT(obj);
                     
                      downloadBttn = new LinkButton();
                      downloadBttn.label = "Download Search Sequences";
                      downloadBttn.name = obj.ENVIRONMENT;
                      downloadBttn.addEventListener(MouseEvent.CLICK,function (e:MouseEvent):void {
                          downloadSeqRequest(e,obj); });
                      this.addChild(downloadBttn);
                  }

       

                .

                .

                .

      ]]>
          </fx:Script>
         
          <fx:Declarations>
              <cfservice:SearchRPC id="SearchRPC" showBusyCursor="true" fault="util.faultHandler(event)"
                  destination="ColdFusion" endpoint="http://localhost/flex2gateway" source="cfc.SearchRPC"/>
              <!--<s:CallResponder id="getSearchRSLTResult" result="searchDBHandler(event)"/>-->
              <s:CallResponder id="getSearchRSLTResult"/>
          </fx:Declarations>
         
          <mx:DataGrid id="searchDBResult" dataProvider="{getSearchRSLTResult.lastResult}"
              editable="false" width="100%" height="100%">
              <mx:columns>
                  <mx:DataGridColumn headerText="sequenceId" dataField="sequenceId"/>
                  <mx:DataGridColumn headerText="sequenceName" dataField="sequenceName"/>
                  <mx:DataGridColumn headerText="sequenceLen" dataField="sequenceLen"/>
                  <mx:DataGridColumn headerText="hspBitScore" dataField="hspBitScore"/>
                  <mx:DataGridColumn headerText="blastDb" dataField="blastDb"/>
                  <mx:DataGridColumn headerText="hitName" dataField="hitName"/>
                  <mx:DataGridColumn headerText="hspAlignLen" dataField="hspAlignLen"/>
                  <mx:DataGridColumn headerText="hspEvalue" dataField="hspEvalue"/>
                  <mx:DataGridColumn headerText="hspSimilarity" dataField="hspSimilarity"/>
                  <mx:DataGridColumn headerText="hspIdentity" dataField="hspIdentity"/>
              </mx:columns>
          </mx:DataGrid>

       

      </mx:Panel>

       

       

       

      I would ideally like to get my datagrid created in an action script instead of creating my datagrid as an mxml component.

       

      Am I doing something wrong or missing something? Please help me figure this out

       

      Thanks

       

      Jay

        • 1. Re: Paging not working
          Flex harUI Adobe Employee

          Are you trying to implement your own paging scheme?  We'll need more info on the client-server communications you are using.

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: Paging not working
            kingquattro Level 1

            No, I am not using my own paging scheme.  In Flash builder 4 I have setup my DataService for a ColdFusion cfc.  Then configure a return type, and enabled paging. In flex is am using rpc call as below to communicate with my cfc.

             

            <fx:Declarations>
                    <cfservice:SearchRPC id="SearchRPC" showBusyCursor="true" fault="util.faultHandler(event)"
                        destination="ColdFusion" endpoint="http://localhost/flex2gateway" source="cfc.SearchRPC"/>
                    <!--<s:CallResponder id="getSearchRSLTResult" result="searchDBHandler(event)"/>-->
                    <s:CallResponder id="getSearchRSLTResult"/>
                </fx:Declarations>

            • 3. Re: Paging not working
              SunilAdobe Adobe Employee

              When setting up the paging, have you given the correct unique key. Providing the unique key is essential for paging to work. Also the key that you provide should be unique in the database table too from where you are fetching the data.

               

              Thanks

              -Sunil

              • 4. Re: Paging not working
                kingquattro Level 1

                Thanks for you all your help,

                     I have seem to figure out the problem. As Sunil mentioned the unique key value is very important.  I took another look at my sql, and turns out that I might get multiple row for a sequence.  Fixed this issue, and paging works as expected. 

                 

                 

                Thanks again for your help.

                 

                Jay

                • 5. Re: Paging not working
                  kingquattro Level 1

                  Thanks for you all your help,

                       I have seem to figure out the problem. As Sunil mentioned the unique key value is very important.  I took another look at my sql, and turns out that I might get multiple row for a sequence.  Fixed this issue, and paging works as expected. 

                   

                   

                  Thanks again for your help.

                   

                  Jay