Successfully!

Error!

You are viewing 10.0 help doc. More details are displayed in the latest help doc

JS interface on the App Terminal

I. Mobile App supports calling JS

Web EventPagination PreviewData Entry Preview 
Load start √√  
  End of loading √√  
  Before data entery
√  
  After data entry
√  
  Data entry successful
√   
Data entry faild
√   


Report internal JSCellchart
Hyperlink JS√  √  

Note: The internal JS of the chart can realize the hyperlink; but when the chart is used as a dashboard component, the JS click event added for the component is not supported.

Widget eventParameter widgetData entry widget Dashboard widget
After Initialization event √
Before editing


After editing √
End of edit √  √
Click √ √ √
Value change


Node generation


State change √  √ √
After uploading


Note 1: The widget of the dashboard refers to the widget in the body of the dashboard, excluding the widget in the parameter panel of the dashboard.

Note 2: The mobile terminal only supports the initialization of the parameter interface widgets, but does not support the initialization of the parameter panel

Note 3: The component currently does not support click even

II. Object

Note: The following functions are supported in App 9.0 and App 10.0.

Function nameOverviewUsing scopeExample
contentPaneThe container for storing the content of the CPT report, that is, the entire CPT report object

1) Only available in CPT, not available in FRM

2) Web events, cell hyperlink JS, cell widget events in the report, CPT parameter interface widgets events, you can get the object directly through contentPane


Get the CPT reporting cell widget:

contentPane.getWidgetBycell("cell")


_g()

1) In CPT, _g() is the entire report object contentPane, which supports all supported methods under contentPane

2) In FRM, _g() is the entire form objectglobalForm, which supports all supported methods under globalForm


1) _g().parameterCommit() can be used to realize automatic query in the parameter interface widget event in CPT/FRM

2) In the CPT reporting cell widget event, _g().verifyAndWriteReport() and other reporting methods can be used to submit to the library

3) In the event of report block and icon block in FRM, the objects in the main body of the form can be obtained through _g().options.form

4) Get the FRM main widget:

_g().options.form.getWidgetByName("name")

parameterEl

Parameter panel object, the widget can be obtained through parameterEl.getWidgetByName("name")

The parameter interface in CPT and FRM is parameterEl:

1) In CPT, the parameter interface is obtained through contentPane.parameterEl, which is mainly used in the loading start and end events of Web events in CPT, and in CPT cell JS

2) In FRM, the parameter interface is obtained through _g().parameterEl, which is mainly used in the body initialization event of FRM, the widgets in the main body of FRM, the report block cell/chart JS of the main body of FRM, the chart block JS


Get the value of the parameter interface widget in the CPT loading end event:

var a = contentPane.parameterEl.
getWidgetByName("aa").getValue();
FR.Msg.alert("Tips",a)


thisIn the event of the widget, the current widget object can be directly obtained through thisWidget refers to the widget in the data entry cell, the widget in the parameter interface, the widget in the body of the formGet the value of the widget in the edit end event of the CPT parameter interface file widget: 
var a = this.getValue();
FR.Msg.alert("Tips",a)


form

1) FORM is a form object

2) The parameter interfaces in CPT and FRM are both forms, and the main body of FRM is also a form

3) There is a current form object FORM in the options of each widget

Therefore, the current form object can be obtained through this.options.form in the event of the parameter interface or the widget of the form body


Get the values of other widgets in the button click event of the CPT parameter interface:

var a = this.options.form.getWidgetByName("a")
.getValue();
FR.Msg.alert("Tips",a)


III. Attributes

Note: The following functions are supported in App 9.0 and App 10.0

Function nameOverviewUsing scopeExample
reportTotalPage

1) The attributes under the contentPane report object, the total number of pages of the current report

2) This attributes will have a value only when it is paging, and it is called by contentPane.reportTotalPage

Note: This function cannot be used in forms, parameter interfaces, and web events.

Get the total number of pages of the current report in the CPT cell hyperlink JS:

FR.Msg.alert("Tips",contentPane.reportTotalPage)


IV. Query operation

Note: The following functions are supported in App 9.0 and App 10.0.

Function nameOverviewFor example
parameterCommit() 

1) Query operation, whether it is CPT or FRM, there will be a built-in query button on the parameter interface, users can trigger the query operation through JS without the built-in query

2) Triggered by contentPane.parameterCommit() or _g().parameterCommit(), and can only be triggered by _g().parameterCommit() in the form


1) The custom button in the CPT parameter interface first verifies the widget, and then triggers the query according to the conditions:

var a = this.options.form.getWidgetByName("a").getValue();
var b = this.options.form.getWidgetByName("b").getValue();
if (a > b) {
    FR.Msg.alert("Warning,","The start month can't be

greater than the end month")
else {
    contentPane.parameterCommit();
    // or _g().parameterCommit();

2) The query is triggered in the click event of the custom button in the FRM parameter interface:

_g().parameterCommit()

V. Page turning operation

Note: The following functions are supported in App 9.0 and App 10.0.

Function nameOverview
Using scopeExample
gotoFirstPage()

1) A method under the contentPane report object, used to jump to the first page of the report

 2) This method is only useful for paging, and it is called by contentPane.gotoFirstPage()

Note: This function cannot be used in forms, parameter interfaces, and web events

Jump to the first page in the CPT cell hyperlink JS:
contentPane.gotoFirstPage()


gotoLastPage()

1) A method under the contentPane report object, used to jump to the last page of the report

 2) This method is only useful when pagination, and it is called by contentPane.gotoLastPage()

Note: This function cannot be used in forms, parameter interfaces, and web events

Jump to the last page of the report in the CPT cell hyperlink JS:

contentPane.gotoLastPage()


gotoPreviousPage()

1) A method under the contentPane report object, used to jump to the previous page of the current page

 2) This method is only useful for paging, and it is called by contentPane.gotoPreviousPage()

3) If the current page is the first page, there should be no response to the trigger event, and the page number should not be less than or equal to 0

Note: This function cannot be used in forms, parameter interfaces, and web events

Jump to the previous page of the current page in the CPT cell hyperlink JS:
contentPane.gotoPreviousPage()


gotoNextPage()

1) A method under the contentPane report object to jump to the next page of the current page

 This method is only useful for paging, and it is called by contentPane.gotoNextPage()

2) If the current page is the last page, there should be no response to the trigger event, and there should be no page number greater than the total number of pages.

Note: This function cannot be used in forms, parameter interfaces, and web events.

Jump to the previous page of the current page in the CPT cell hyperlink JS::
contentPane.gotoNextPage()


VI. Widget operation

Note: The following functions are supported in App 9.0 and App 10.0.

Function namwOverviewExample
getValue()

1) The value method of the widget

2) Get the widget, for example, the obtained widget variable isWidget, then you can get the value of the widget through Widget.getValue()

3) If the widget is a drop-down box, etc., there is a distinction between the displayed value and the actual value, getValue() takes the actual value

1) Get the value of the current drop-down box and the values of other widgets in the edit end event of the drop-down box of the CPT parameter interface:

var comboBox = this.getValue();    
var textEditor = this.options.form.getWidgetByName
("textEditor").getValue();      
FR.Msg.alert("Tips",comboBox + " - "
+ textEditor)                          

2) CPT fills in the edit end event of the drop-down box of the cell to obtain the value of the current drop-down box and the values of other widgets:

var comboBox = this.getValue();
var textEditor = contentPane.getWidgetByName    
("textEditor").getValue();  
FR.Msg.alert("Tips",comboBox + " - " 
+ textEditor)

setValue(value

1) Assignment method of widget

2) If the widget is acquired, for example, the acquired widget variable is Widget, then the value of the widget can be set through Widget.setValue(value).

3) If the widget is a drop-down box, etc., there is a distinction between the displayed value and the actual value, setValue() sets the actual value

4) The parameter description is as follows:

Parameter: value

Parameter type: Object

Parameter description: value

Assign values to other widgets in the CPT parameter interface button click event:

this.options.form.getWidgetByName("textEditor")  
.setValue("Haha")


getText()

1) Take the display value of the widget

2) Get the widget, for example, the obtained widget variable is Widget, you can get the display value of the widget through Widget.getText()

3) Only the five widgets of drop-down box, drop-down check box, drop-down tree, radio button group, and check box group have display values and actual values. These widget s get the actual value with getValue(), getText() What you get is the display value

4) If the widget is a drop-down box, etc., there is a distinction between the displayed value and the actual value, getValue() and getText() take the actual value

Get the actual value and display value of the current drop-down box from the edit end event of the drop-down box in the CPT parameter interface:

var shijizhi = this.getValue();
var xianshizhi = this.getText();
FR.Msg.alert("Tips","Actual value" + shijizhi +";
Display value"
 + xianshizhi)


reset()

1) Clear the data of the widget

2) If the widgetis acquired, for example, the acquired widget variable is Widget, then the data of the widget can be cleared by Widget.reset()

After clicking the button on the CPT parameter interface, the other widgets on the parameter interface will be uniformly reset:

this.options.form.getWidgetByName("a").reset(); 
this.options.form.getWidgetByName("b").reset()

isVisible()

1) Determine whether the widget is visible

2) If the widget is acquired, for example, the acquired widget variable is Widget, then you can use isVisible() to determine whether the widget is visible. It returns true if it is visible, false if it is not visible

Judge whether the widget is visible after clicking the button on the CPT parameter interface:

var a = this.options.form.
getWidgetByName("a").isVisible();
var b = this.options.form.
getWidgetByName("b").isVisible();
FR.Msg.alert("Tips",a + " - " + b)         

setVisible(visible)

1) Set whether the widget is visible

2) Obtain the widget , for example, the obtained widget variable is Widget, then you can set whether the widget is visible through Widgeti.setVisible(visible)

3) The parameter description is as follows:

Parameter: visible

Parameter type: Boolean

Parameter description: the parameter is true to be visible, false to be invisible

In the edit end event of the CPT parameter interface drop-down widget a, whether widget b is visible or not, when a selects Jiangsu, widget b is displayed; when the value of a is Shanghai, widget b is not displayed:

var a = this.getValue();
var b = this.options.form.getWidgetByName("b"); 
if(a == "Jiangsu"){
    b.setVisible(true);
}else if (a == "Shanghai"){
    b.setVisible(false);

setEnable(enable)

1) Set whether the widget is available

2) Get the widget , for example, the obtained widget variable is Widget, then you can set whether the widget is available through Widgeti.setEnable(enable)

3) The parameter description is as follows:

Parameter: enable

Parameter type: Boolean

Parameter description: if the parameter is true, it is available, false is not available

In the edit end event of the CPT parameter interface drop-down widget  a, widget widget b is available. When a selects Jiangsu, widget b is available; when the value of a is Shanghai, widget b is unavailable:

var a = this.getValue();
var b = this.options.form.         
getWidgetByName("b");
if(a == "Jiangsu"){
    b.setEnable(true);
}else if (a == "Shanghai"){
    b.setEnable(false);
isEnabled()

1) Determine whether the widget is available

2) Get the widget , for example, the widget variable we get is Widget, then we can use isEnabled() to judge whether the widget is available

3) Returns true if available, false if not available

Judge whether the widget is visible after clicking the button on the CPT parameter interface:

var a = this.options.form.getWidgetByName("a")
.isEnabled();
var b = this.options.form.getWidgetByName("b"
.isEnabled();
FR.Msg.alert("Tips",a + " - " + b)

fireEvent(eventName)

1) Trigger the widget event with the specified name

2) Acquire the widget , for example, if the acquired widget variable is Widget, then the event of the widget can be triggered by fireEvent(eventName)

3) The parameter description is as follows:

Parameter: eventName

Parameter type: String

Parameter description: the name of the event to be triggere

The click event that triggers the built-in query button in the edit end event of the CPT parameter interface drop-down box:

this.options.form.getWidgetByName("formSubmit0")
.fireEvent("click")

contentPane.getWidgetByCell("Cell")

Get the widget according to the location of the cell where the widget is located

The parameter is the cell nam

-

VII. Data entry operation

Note: The following functions are supported in App 9.0 and App 10.0.

Function nameOverviewExample
verifyReport()

1) Trigger data verification for report filling, which can only be used for CPT report filling

2) Set the filling data check and the timely check of the widget under the single sheet, and trigger the data check in the filling cell widget (select any widget as a button)

3) For each sheet under multiple sheets, set the filling data check and the timely check of the widget , and trigger the data check in the filling cell widget 

Call through contentPane().verifyReport(). If there are multiple sheets in the report, the data verification set in all sheets will be performed, and the immediate verification of the widget will also be verified
writeReport([Object reportIndex])

1) Submit a report, only CPT fills in the report can be used, through contentPane.writeReport () to call, if the filled report has multiple sheets, all sheets will be submitted

2) You can also submit the specified sheet through contentPane.writeReport(reportIndex), writeReport is mandatory and will not be verified

3) The parameter description is as follows:

Parameter: reportIndex

Parameter type: Object

Parameter description: optional, sheet number, starting from 0

After clicking the fill-in cell button, the fill-in submission is triggered:

contentPane.writeReport()              

verifyAndWriteReport([Object isAllSheet])


1) Verify and submit the report, only CPT can use the report

2) It can be called by contentPane.verifyAndWriteReport(), if there are multiple sheets in the report, contentPane.verifyAndWriteReport() will submit the current sheet

Submit all sheets via contentPane.verifyAndWriteReport(true)

3) The parameter description is as follows:

Parameter: isAllSheet

Parameter type: Object

Parameter Description:

If you don’t fill in or fill in 0, it means submit the current sheet

When you fill in true or fill in a number other than 0, submit all sheets

The parameter cannot be a non-true or numeric string, it is not supported and cannot be submitted

After clicking the fill in cell button, the verification will be triggered and the report will be submitted:

contentPane.verifyAndWriteReport()  


refreshAllSheets()

1) Refresh all sheets, it can only be used when filling in the report

2) In multi-sheet filling, you can refresh all sheets through contentPane.refreshAllSheets(), and after refreshing, it will stay on the sheet page viewed last time

In the second sheet of the report, click a cell button to trigger all sheets to refresh:

contentPane.refreshAllSheets()


getCellValue(Object o)

1) Get the value of the cell

2) The value of the cell can be obtained through contentPane.getCellValue(o) in the web event, cell button or JS of the report.

3) For parameter description, please refer to Section VII.1 of this document

1) Take the value of cell A1 in the report cell button:

var a = contentPane.getCellValue(0,0);
//If there are only 2 parameter values, the first
is the column number and the second is the row
 number
FR.Msg.alert("Tips", a)

2) Take the value of cell A1 of shee2 in the report cell button:

var a = contentPane.getCellValue(1,0,0);
FR.Msg.alert("Tips",a)
setCellValue(Object o)

1) In the web event, cell button or JS of the report, you can use contentPane.setCellValue(o) to assign the value of the cell. The actual value is assigned, which can be submitted to the library

2) For parameter description, please refer to Section VII.2of this document.

Assign a value to cell A1 in the button for filling in the report cell, and then submit it for storage:

contentPane.setCellValue(0,0,"aa");
///If there are only 3 parameter values, the first
one is the column number,
The second is the row number, the third is the value


1. getCellValue(Object o)Parameter Description

The parameter description of getCellValue(Object o) is shown in the following table:

Parameter TypeInstruction
oObjectCell positioning description

oParameter format{reportIndex:0, columnIndex: 2, rowIndex: 1},The specific instructions are shown in the following table:

Parameter TypeInstruction
reportIndexNumberOptional, sheet number, starting from 0
columnIndexNumberRequired, column number, starting from 0
rowIndexNumberRequired, line number, starting from 0

Return value description is shown in the following table:

Cell elementReturn value typeResult
Normal text

Depends on cell value type

Number(number)

String(String)

Corresponding value

Data column

Note: getCellValue obtains the value of the corresponding position of the result report; if it is a data column, it obtains the value of the corresponding position after expansion


Depends on the final cell value type

It can be a string (string), a number (number),

Date or array (object)


String-corresponding value

Number-corresponding value

Date or array-[object Object]


Rich textstringContent in rich text, excluding html tags

Chart

stringSuch as com.fr.chart.chartattr.ChartPainter@795d0ccf

Image

objectobject
Formula

Depends on formula return type

It can be a string (string), a number (number),

Date or array (object)


String-corresponding value

Number-corresponding value

Date or array-[object Object]



2. setCellValue(o) Parameter Description

The parameter description of setCellValue(o) is shown in the following table:

Parameter TypeInstruction
oObjectCell positioning description, and assigned value

o The format of the parameters {reportIndex:0, columnIndex: 2, rowIndex: 1, value:'aa'}, the specific description is shown in the following table:

Parameter TypeInstruction
reportIndexNumberOptional, sheet number, starting from 0
columnIndexNumberRequired, column number, starting from 0
rowIndexNumberRequired, line number, starting from 0
valueString\numberRequired, value

VIII. Hyperlink

Note: The following functions are supported in App 9.0 and App 10.0.

1. FR.doHyperlinkByGet function

Function nameOverviewExample
FR.doHyperlinkByGet

Hyperlink, tool method under FR

accessible

FR.doHyperlinkByGet(url,config,target,feature)Call it wherever JS can be written

1) Click on the hyperlink of the CPT cell to open the sub-template and pass the parameter:

var url = "/WebReport/ReportServer?reportlet=
WorkBook2.cpt"
;
var a = "123";
FR.doHyperlinkByGet(url,{a:a, b:"456"},         
"_self")

2) Click the hyperlink of the CPT cell to open the sub-template and set the title:

var url = "/WebReport/ReportServer?reportlet    
=WorkBook2.cpt"
;
var a = "123";
FR.doHyperlinkByGet({url : url, title:
"I am title", para : {a:a, b: "456"}, 
target : "_self"})

FR.doHyperlinkByGetThe parameter description is shown in the following table:

Parameter TypeInstruction
urlObject

Required, URL or Json hyperlink definition

URL supports absolute paths such as

http://192.168.100.1:8080/WebReport/ReportServer?reportlet=WorkBook2.cpt

Relative path such as/WebReport/ReportServer?reportlet=WorkBook2.cpt  Or

ReportServer?reportlet=WorkBook2.cpt 

configObjectOptional, passed parameter
targetObjectOptional, the opening position of the hyperlink page
featureObjectOptional, the attribute of the opening position of the hyperlink, this attribute is invalid on the mobile terminal

2. FR.doHyperlinkByPost function

Function nameOverviewExample
FR.doHyperlinkByPost

Hyperlinks, tool methods under FR, can be passedFR.doHyperlinkByPost(url,config,target,feature)Call it wherever JS can be written

1) Click on the hyperlink of the CPT cell to open the sub-template and pass the parameter:

var url = "/WebReport/ReportServer?reportlet=WorkBook2.cpt";    
var a = "123";
FR.doHyperlinkByPost(url,{a:a, b:"456"},"_self")

2) Click the hyperlink of the CPT cell to open the sub-template and set the title:

var url = "/WebReport/ReportServer?reportlet=WorkBook2.cpt";
var a = "123";
FR.doHyperlinkByPost({url : url, title : "I am title",           
para : {a:a, b: "456"}, target : "_self"})

FR.doHyperlinkByPost The parameter description is shown in the following table::

Parameter TypeInstruction
urlObject

Required, URL or Json hyperlink definition

URL supports absolute paths such as

http://192.168.100.1:8080/WebReport/ReportServer?reportlet=WorkBook2.cpt

Relative path such as/WebReport/ReportServer?reportlet=WorkBook2.cpt Or

ReportServer?reportlet=WorkBook2.cpt 

configObjectOptional, passed parameter
targetObjectOptional, the opening position of the hyperlink page
featureObjectOptional, the attribute of the opening position of the hyperlink, this attribute is invalid on the mobile terminal

IX. Platform operation

Note: The following functions are supported in App 9.0 and App 10.0.

Function name
OverviewExample
FS.tabPane.closeActiveTab

1) Close the current Tab tab page

2) It can be called by window.parent.FS.tabPane.closeActiveTab() in any place where JS can be used in the report

Note: It cannot be called in the parameter interface

Close the current Tab tab page in CPT cell hyperlink JS:

window.parent.FS.tabPane.closeActiveTab()


FR.logoutApp

1) Logout, the method under the FR tool category

2) It can be called from any place where JS can be written through FR.logoutApp()

Note: It cannot be called in the parameter interface

Log out in CPT cell hyperlink JS:

FR.logoutApp()


FS.tabPane.addItem

1) Add items to the Tab column of the decision-making platform

2) It can be called by window.parent.FS.tabPane.addItem(entry) in any place where JS can be used in the report


In the CPT cell hyperlink JS, open the sub-report of the hyperlink in the new Tab of the decision-making platform:

window.parent.FS.tabPane.addItem({title:"Subreport",
src:"/WebReport/ReportServer?reportlet=Template1.cpt"})


FS.tabPane.addItem The parameter description of the function is shown in the following table:

Parameter TypeInstruction
entryObjectRequired, the entry object corresponding to the Tab item

「entry」Provided in json format, the attributes are shown in the following table:

Attribute
TypeInstruction
titleString,numberThe title of the tab page, string and number are all available
srcStringThe address to which the content of the tab page points

X. Tab component operation

Function nameOverviewExample
getShowIndex

Get the currently displayed Tab number of the Tab component through getShowIndex

Note: This function is supported in App10.0.

Refer to the showCardByIndex function example
setTabVisible

1) Through setTabVisible(tabName String, isVisible Boolean) can hide part of the Tab title

2) The description of parameter 1 is as follows:

 Parameter 1: tabName

Parameter 1 type: String

Description of Parameter 1: Required, Tab widget name, such as Tab0

3) The description of parameter 2 is shown in the figure below:

Parameter 2: isVisible

Parameter 2 type: Boolean

Description of parameter 2: Required, whether Tab is visible, ture visible/false hidden

Note 1: This function is supported in App 10.0.

Note 2: Cannot be used in the initialization event and parameter interface of tablayout.

Different users can see different Tabs:

var user = this.options.form.getWidgetByName("user")
.getValue();
if(user=='a'){
    this.options.form.getWidgetByName("tabpane0")
    .setTabVisible("Tab0", true);
    this.options.form.getWidgetByName("tabpane0")
    .setTabVisible("Tab1", true);
    this.options.form.getWidgetByName("tabpane0")
    .setTabVisible("Tab2", true);
}else{
    this.options.form.getWidgetByName("tabpane0")
    .setTabVisible("Tab0", false);
    this.options.form.getWidgetByName("tabpane0")
    .setTabVisible("Tab1", true);
    this.options.form.getWidgetByName("tabpane0")
    .setTabVisible("Tab2", false);

showCardByIndexshowCardByIndex(Number cardID)

Effect: You can jump to the specified Tab block

Parameter: cardID

Description: required, the displayed Tab number, starting from 0


showCardByIndex(Number: cardID, Boolean: animated);

Effect: Add the animated parameter to control whether there is an animation effect on the switching Tab page,

          Only takes effect when the style of the mobile terminal title bar allows horizontal scrolling

Parameter: animated

Description: Optional, animated is 1 to turn on the animation, 0 to turn off the animation


Add a post-initialization event to the body to realize automatic loop jump Tab in a fixed time interval:

setInterval(function(){   
    var aa=_g().getWidgetByName("tabpane0")
    .getShowIndex(); 
    if(aa==2){ 
      _g().getWidgetByName('tabpane0')
      .showCardByIndex(0); 
    }
    else { 
      _g().getWidgetByName('tabpane0')
      .showCardByIndex(aa+1); 
    } 
},2000)

Note: For specific examples, please refer to: JS Stay on the Current Tab after Clicking QueryJS Click on Hyperlink to Switch TAB Page

XI. JSON object operation

Overviewoperation

Some requests or methods return Json data, you can get the value of the name attribute through json.name

Note: This function is supported in App 9.0 and App 10.0.

Get device information through FR.Mobile.getDeviceInfo in cell js, and take out the Model device model in it:

var a = FR.Mobile.getDeviceInfo();
FR.Msg.alert(a.Model)


XII. Other operations

Function nameOverviewExample
FR.cjkEncode

1) Perform special encoding conversion on Chinese, Japanese and Korean, and return the converted string to call through FR.cjkEncode (Object text). Generally, with Hyperlink JS, the Chinese characters in the Hyperlink are transcoded to prevent garbled characters.

2) The parameter description is as follows:

Parameter: text

Parameter type: Object

Parameter description: required, string to be encoded

Hyperlink to Chinese name template in CPT cell hyperlink JS:

var url = FR.cjkEncode("/WebReport/ReportServer
?reportlet=template1.cpt"
);
var a = "123";
FR.doHyperlinkByGet(url,
{a:a, b:"456"}, "_self")

FR.cjkDecode

1) Convert the string processed by cjkEncode into the original string and call through FR.cjkDecode(Object text)

2) The parameter description is as follows:

Parameter: text

Parameter type: Object

Parameter description: required, the string to be decoded


In the CPT cell hyperlink JS, use FR.cjkEncode to encode Chinese,

 and then use FR.cjkDecode to decode:

var a = "Haha";
var b = FR.cjkEncode(a);
var c = FR.cjkDecode(b);
FR.Msg.alert("Tips",b + ":" + c)      


FR.ajax

1) The encapsulated jQuery.ajax() function has done Chinese, Japanese and Korean encoding for the data parameter, which can be called in any place where JS can be used through FR.ajax(options)

2) Refer to Section XIII.1 for parameter description


Send an ajax request in the cell hyperlink JS of CPT, and

 handle different situations in different callback functions:

var username = "1";
var password = "1";
FR.ajax({   
   url:"http://env.finedevelop.com:59204/Test
/ReportServer?op=fs_load&cmd=sso"
,
   data:{
        fr_username:username,
        fr_password:password
   },
   dataType:"jsonp",    
   timeout:5000,
   //success:function(data) { /
        //FR.Msg.alert("success",data.status);
   //},   
   //error:function(errorThrown){   
        //FR.Msg.alert("error",errorThrown);
   //},
   complete: function(res,textStatus)
        FR.Msg.alert("complete",textStatus); 
   }  
})
setInterval

1) The setInterval() method can call functions or calculation expressions according to the specified period (in milliseconds).

2) The setInterval() method will keep calling the function until clearInterval() is called or the window is closed. The ID value returned by setInterval() can be used as a parameter of the clearInterval() method.

3) Call through setInterval(code,millisec)

4) Refer to chapter XIII.2 for parameter description

Define the report refresh every 3s in the report

 loading end time:

setInterval("self.location.reload();",3000)


setTimeout

1) Used to call a function or calculation expression after the specified number of milliseconds. Call by setTimeout(code,millisec)

2) For parameter description, please refer to Section XIII.3

Note: When the JS code is setTimeout(function(){}) format, "this" needs to be used outside the declaration.

1) A prompt will pop up 3s after the report loading end time:

setTimeout("FR.Msg.alert('Reminder','I am a delayed reminder')",3000)

2) A prompt will pop up 3s after the report loading end time:

setTimeout(function() {

    FR.Msg.alert('reminder','I am a delayed reminder');

}, 3000)

FR.location

1) Usage scenario

FR.location is used to realize the positioning function and obtain the latitude and longitude, which can be used in App, enterprise WeChat, and Dingding

2) Function usage

FR.location(function(status, message){...})

3) Matters needing attention

If you want to use it in enterprise WeChat and Dingding, you need to update the HTML5 mobile display plug-in and WeChat or Dingding management plug-in to version 10.4.975

Get the current latitude and longitude in cell JS:

FR.location(function(status, message)
if(status=="success") {  
    FR.Msg.alert("Current location is:" 

+ message);   
else { 
    FR.Msg.alert(message);             

})


FR.Mobile.getDeviceInfo

Get device information, call FR.Mobile.getDeviceInfo(), return Json object, including two attributes, one is the device model, the other is the unique id of the device

In the post-loading event, assign the device model and the unique id of the device to the cell:

var b = FR.Mobile.getDeviceInfo();
contentPane.setCellValue(0,0,b.Model);
contentPane.setCellValue(0,1,b.DeviceID)  

location.reload

1) Refresh the current page, which has the same effect as manual refresh

2) If the report has multiple pages, it will return to the first page after refreshing; if the report has a parameter interface, the result of the last parameter condition query will be displayed directly after refreshing

Write refresh JS in the report success event to refresh the current page after the report is successful:

location.reload()                  

window.closeClose the current window

Write JS in the report success event, close the template after the report is successful, and return to the directory: 

window.close()                      

FR.remoteEvaluateAsync

Return the result of formula calculation

Note 1: App support after version 10.4.46

Note 2: To use this interface, you need to close the script call formula limit

2 parameter, respectively representing:

1) formula: required, specific formula

2) callback: required, the specific callback method, you can get the value calculated by the formula


FR.cellStr2ColumnRow("Cell")

Can convert cells to row and column numbers

Know the specific cell and be able to locate the row and column number of the cel

FR.cellStr2ColumnRow('B1')

The return value is {"col":1,"row":0}

1. FR.ajax Parameter Description

The parameter description of the FR.ajax function is shown in the following table:

Parameter TypeInstruction
optionsObjectRequired, ajax parameter

[Options] Provided in json format, the attributes are shown in the following table:

AttributeTypeInstruction
urlStringRequired, the address to send the request
dataObject

The data sent to the server. The GET request will be automatically converted to the request string format and appended to the URL.

The value must be in Key/Value format, which can be a string such as p1=pavalue&p2=p2value, or an object such as {p1:p1value,p2:p2value}

typeStringRequest method POST/GET, the default is GET
dataTypeString

The type of data that the server is expected to return. If it is not specified, it will be automatically judged intelligently based on the MIME information of the HTTP package. Available values are:

json: Return JSON data.

text: returns a plain text string.

jsonp": adopt jsonp method across domains

successFunctionThe callback function after the request is successful:
success: function(data, textStatus){  
//data is returned by the server, and according to the dataType
parameter
//Data after processing. textStatus is the status value success
}&nbsp

errorFunctionCall this function when the request fails:
error: function(XMLHttpRequest, textStatus, errorThrown){ 
//The parameters are XMLHttpRequest object, error message, and
exception object captured.
//Usually only one of textStatus and errorThrown will contain
information
 }&nbsp

completeFunctionCallback function after the request is completed (call after the request succeeds or fails):
complete: function(XMLHttpRequest, textStatus){  
/The parameters are respectively XMLHttpRequest
//Object and a string describing whether the successful request
was successful
 } &nbsp

timeoutNumberSet the request timeout time (milliseconds)
async BooleanThe default is true, all requests are asynchronous requests. If you need to send a synchronization request, please set this option to false

2. setInterval Parameter Description

Parameter TypeInstruction
codeObjectRequired, the function to be called or the code string to be executed
millisecNumberThe time interval between periodically executing or calling code, in milliseconds

3. setTimeout Parameter Description

Parameter TypeInstruction
codeObjectRequired, the JavaScript code string to be executed after the function to be called
millisecNumberThe number of milliseconds to wait before executing the code

4. FR.remoteEvaluateAsync Parameter Description

Parameter TypeInstruction
formulaStringRequired, specific formula
callbackfunctionRequired, the specific callback method, you can get the value calculated by the formula

XIII. MSG Pop-ups

Function nameOver viewExample
FR.Msg.alert

1) A prompt dialog box with a pop-up message

It can be called in any place where JS can be written through FR.Msg.alert(Object title, Object message[, Object callback])

2) For parameter description, please refer to Section XVI.1 of this document

1) After clicking the fill in cell button, a prompt pops up:

FR.Msg.alert("Reminder","I am the first reminder")


2) After clicking the fill in cell button, a prompt will pop up, and it will automatically close after 2s:

FR.Msg.alert("Reminder","I am the second reminder", 2000)


3) After clicking the fill-in cell button, a prompt pops up, and click the OK button in the prompt box to trigger a callback event and prompt:

FR.Msg.alert("Prompt","I am the third prompt",function(value){

    FR.Msg.alert("Prompt", value);

})


FR.Msg.toast

1) A floating prompt pops up and disappears automatically in 5s. It can be called from any place where JS can be written through FR.Msg.toast(Object message)

2) The parameter description is as follows:

Parameter: message

Parameter type: Object

Parameter description: the message to be displayed


A floating prompt pops up after clicking the Fill in Cell button:


FR.Msg.toast("hint","I am the first floating tip")


FR.Msg.confirm

1) The pop-up confirmation dialog box

You can call FR.Msg.confirm(Object title, Object message[,Object callback, Object min_width ]) at any place where JS can be written


2) For parameter description, please refer to Section XVI.2 of this document


1) After clicking the fill in cell button, a confirmation box will pop up:

FR.Msg.confirm("Prompt","I am the first to confirm")


2) After clicking the fill-in cell button, a pop-up confirmation box will pop up, and when the OK and Cancel buttons are clicked, different callback prompts will pop up:

FR.Msg.confirm("Prompt","I am the second confirmation",function(value){

    FR.Msg.alert("Prompt", value);

})


FR.Msg.prompt

1) The pop-up input dialog box

You can call FR.Msg.confirm(Object title, Object message, Object value, Object callback, Object min_width) at any place where JS can be written


2) For parameter description, please refer to Section XVI.3  of this document


1) After clicking the fill in cell button, an input box will pop up:

FR.Msg.toast("hint","I am the first floating tip")

2) After clicking the fill in cell button, an input box will pop up, and the input value will be prompted when you click OK:

FR.Msg.prompt("Prompt","I am the second input",

null,function(value){

    FR.Msg.alert("Prompt", value);

}

1. FR.Msg.aler Parameter Description

FR.Msg.aler parameter description is as follows:

ParameterTypeInstruction
titleObjectRequired, the title of the message box
messageObjectRequired, the content of the message prompt box
callbackObjectOptional, the dialog box displays future callback functions. If the parameter is a number type, it means that the dialog box is automatically closed after the specified time (unit: milliseconds)

2. FR.Msg.confirm Parameter Description

FR.Msg.confirm parameter description is as follows:

ParameterTypeInstruction
titleObjectRequired, the title of the message box
messageObjectRequired, the content of the message prompt box
callbackObjectOptional, click to confirm the callback function
min_widthObjectOptional, confirm the minimum width of the dialog box, this attribute is invalid on the mobile terminal

3. FR.Msg.prompt Parameter Description

The FR.Msg.prompt parameter description is as follows:

ParameterTypeInstruction
titleObjectRequired, enter the title of the dialog
messageObjectOptional, enter the message displayed in the dialog box
valueObjectOptional, enter the default value of the dialog box
callbackObjectOptional, click to confirm the callback function
min_widthObjectOptional, confirm the minimum width of the dialog box, this attribute is invalid on the mobile terminal

XIV. Specific usage example

1. A series of methods to get the widget 

this.options.form.getWidgetByName("widget name");  
contentPane.getWidgetByCell("cell");  /
contentPane.getWidgetByName("widget name");                                                             


2. JS Get Dashboard chart and report block

JS get the dashboard chart component and refresh the data

For details, please see:  Refresh Data the Chart of a Dashboard


3. Delay function

setTimeout(function(){},500)

4. Refresh

1) Refresh the current page

location.reload(

For details, please see:  Refresh the current page

2)Timing refresh, support timing JS, and cancel timing

setInterval('location.reload();',10000);                            
var timer = setInterval('location.reload();',10000);clearInterval(timer);                                

For details, please see: Auto Refresh of Dashboard


5. Get geographic location

FR.location(function(status, message)
if(status=="success") {
  FR.Msg.alert("Current location is: " + message);                                                      
  contentPane.setCellValue(23, message);  
else {
  FR.Msg.alert(message);
}
})

For details, please see: Get Current Geographic Location


6. Inquire

For query operation, whether it is cpt or frm, there will be a built-in query button on the parameter interface, and users can trigger the query operation through JS instead of the built-in query

1) Ordinary reports can be triggered in the following two ways

contentPane.parameterCommit()
_g().parameterCommit(

2) The dashboard can only be triggered by one of the following methods

_g().parameterCommit(

For details, please see: JS Automatic Query in Dashboards

For details, please see: JS Scan Code Can Query Information


7. Hyperlink

FR.doHyperlinkByGet({url:'${servletURL}?viewlet=JS Hyperlink custom title sub-table.cpt',
title:'Title is me',para:{area:'North China'}});

Note: title is only supported in App

For details, please see: JS Custom Hyperlink Title


8. Logout APP

FR.logoutApp()

For details, please see JS realizes logout App 


9. Get the display value and actual value of the widget

var Widget = this.options.form.getWidgetByName("t1");
//To obtain the widget rol in the parameter interface, first obtain the dashoboard, and then obtain
the widget by the widget name
var value_1 =Widget.getValue(); //Get the actual value of the widget
alert('My actual value is:'+value_1); //The actual value of the pop-up widget
var value_2 =Widget.getText(); //Get the display value of the widget
alert('My display value is:'+value_2); //The pop-up widget display value

For details, please see Actual Value and Diaplay Value

Attachment List


Theme: Fine Mobile
Already the First
Already the Last
  • Helpful
  • Not helpful
  • Only read

Doc Feedback