How to: Reference: |
This topic describes the steps for initializing a WebFOCUS Enable application and provides sample initialization code. It also describes the functions for performing initialization, running a WebFOCUS procedure, and getting data into the application.
This code tells the application that the initApp() function will run first.
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()" width="862"> <mx:Script> <![CDATA[ //Instantiate an ibiObject public var basedataarray:ibiObject = new ibiObject(); // assigning URL public var fex:String = "http://localhost:8080/ibi_apps/WFServlet ?IBIF_ex=xmltest";
//Initializing an Application public function initApp():void { basedataarray.init(fex,dataReady); } public function dataReady(grid:ibiObject,obj:*):void //public function dataReady(grid:ibiObject):void { //populateGrid will put the data into ArrayCollection prGridfiltered basedataarray.populateGrid(false); //fill out the base array collection load_main1(); //load the named grid with the data from the basearray } public function load_main1():void { //Assign the populated Data to the dataGrid as a dataProvider main1.dataProvider = basedataarray.prGridfiltered; } ]]> </mx:Script>
<!-- Declare the grid in the MXML --> <mx:DataGrid x="10" y="22" width="268" height="156" id="main1"> <mx:columns> <mx:DataGridColumn headerText="REGION" dataField="REGION"/> <mx:DataGridColumn headerText="ST" dataField="ST"/> <mx:DataGridColumn headerText="DOLLARS" dataField="DOLLARS"/> <mx:DataGridColumn headerText="UNITS" dataField="UNITS"/> </mx:columns> </mx:DataGrid> </mx:Application>
callback of type Function: Points to the function you are passing in the init method.
Note: Flash Player 6 and later interprets external text files as Unicode. To enable the Flash Player to interpret external files in the default code page of the operating system running the player, the useCodePage property must be set to true (by default, it is set to false). For users not using API, the useCodePage is set to true automatically when ibiCanvas is added. To manually set this, you must apply the following code to initApp() or whatever function you are using for initialization in your ActionScript:
System.useCodePage=true;
When this code is present, the Flash Player interprets external text using the traditional code page of the operating system running the Flash Player. This is generally CP1252 for an English Windows operating system and Shift-JIS for a Japanese operating system. If you set useCodePage to true, the traditional code page of the operating system running the player must include the characters used in your external text file in order to display your text. For example, if you load an external text file that contains Chinese characters, those characters cannot display on a system that uses the CP1252 code page because that code page does not include Chinese characters. When possible, you should ensure that users on all platforms can view external text files used in your SWF files that are Adobe Flash Player compatible by encoding all external text files as Unicode and leaving useCodePage set to false. This way, the Flash Player interprets the text as Unicode.
byLabel of type Array: Specifies which column is used as the criteria for grouping the rows of a DataGrid. The rows of the grid are grouped according to the byLabel value.
calculateOption of type Array: After grouping the rows, the aggregate function creates a new column that will display the sum, maximum, minimum, or average value of each group of items. It can also show the total number of items in each group (count). The calculateOption specifies which of these options is used in the newly created column.
useFilter of type Boolean: Specifies whether or not to use the prGridfiltered as the grid to group. If useFilter is false, the main grid (prGrid) is used as the grid to group.
createGrid of type Boolean: Specifies whether or not to create a DataGrid of columns. Default is false.
Types of Aggregation: Sum, Average, Max, Min, Count, Distinct
useFilter of type Boolean: Takes true to create a row of values in a selected column from the filtered grid.
useFilter of type Boolean: Takes true to create a row of unique values in a selected column from the filtered grid.
WebFOCUS |