Export with Server Paging

Parent Previous Next

Additional information When filterPageSortMode=server:

When filterPageSortMode=server, print/export works a little differently when you select “all pages” or “selected pages”. In this case, you need to wire up the PrintExportDataRequest event


         //This event is only fired when the user requests to print data that is currently

           //not loaded in the grid. It is only applicable when filterPageSortMode is set to

           //'server', because in this mode, the grid only requests the current page of data

           //from the server.

           //For example, if the user asks to print pages 1-4 of a 10

           //page grid, and we're currently on page #4, on the client, we only have the records

           //from page #4. So we have to get the records from pages 1-4 from the server.

           //when this data comes back, we just set the grids.printExportData property, and the

           //print/export mechanism continues as usual.

           private function onPrintExportDataRequest(event:PrintExportDataRequestEvent):void

           {

               //here we build our custom filter object and send it to the server

                       ...

       

           //Function to call when server call returns.

           private function onPrintExportDataResponse(event:ResultEvent):void

           {

                   //This response came back as a result of a print request. so set

                   // the print export data on the grid and have the print/export

                   //mechanism continue on its way

                   dgEmployeesServer.printExportData=event.result.records;

               ...



Review the code here:

http://www.flexicious.com/resources/Flex/srcview/source/com/sample/examples/ServerGridDotNet.mxml.html


This code demonstrates how to handle the printExportDataRequest event, and is heavily commented to explain what is going on.