I. Mobile App supports calling JS
Web Event | Pagination Preview | Data Entry Preview |
---|---|---|
Load start | √ | √ |
End of loading | √ | √ |
Before data entery | √ | |
After data entry | √ | |
Data entry successful | √ | |
Data entry faild | √ |
Report internal JS | Cell | chart |
---|---|---|
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 event | Parameter widget | Data 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 name | Overview | Using scope | Example |
---|---|---|---|
contentPane | The 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:
| |
this | In the event of the widget, the current widget object can be directly obtained through this | Widget refers to the widget in the data entry cell, the widget in the parameter interface, the widget in the body of the form | Get the value of the widget in the edit end event of the CPT parameter interface file widget:
|
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:
|
III. Attributes
Note: The following functions are supported in App 9.0 and App 10.0
Function name | Overview | Using scope | Example |
---|---|---|---|
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:
|
IV. Query operation
Note: The following functions are supported in App 9.0 and App 10.0.
Function name | Overview | For 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(); greater than the end month") 2) The query is triggered in the click event of the custom button in the FRM parameter interface:
|
V. Page turning operation
Note: The following functions are supported in App 9.0 and App 10.0.
Function name | Overview | Using scope | Example |
---|---|---|---|
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:
| |
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:
| |
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:
| |
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::
|
VI. Widget operation
Note: The following functions are supported in App 9.0 and App 10.0.
Function namw | Overview | Example |
---|---|---|
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(); 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(); |
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") |
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(); |
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(); |
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. |
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(); |
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") |
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") |
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 name | Overview | Example |
---|---|---|
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:
|
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:
2) Take the value of cell A1 of shee2 in the report cell button:
|
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:
|
1. getCellValue(Object o)Parameter Description
The parameter description of getCellValue(Object o) is shown in the following table:
Parameter | Type | Instruction |
---|---|---|
o | Object | Cell positioning description |
oParameter format{reportIndex:0, columnIndex: 2, rowIndex: 1},The specific instructions are shown in the following table:
Parameter | Type | Instruction |
---|---|---|
reportIndex | Number | Optional, sheet number, starting from 0 |
columnIndex | Number | Required, column number, starting from 0 |
rowIndex | Number | Required, line number, starting from 0 |
Return value description is shown in the following table:
Cell element | Return value type | Result |
---|---|---|
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 text | string | Content in rich text, excluding html tags |
Chart | string | Such as com.fr.chart.chartattr.ChartPainter@795d0ccf |
Image | object | object |
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 | Type | Instruction |
---|---|---|
o | Object | Cell 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 | Type | Instruction |
---|---|---|
reportIndex | Number | Optional, sheet number, starting from 0 |
columnIndex | Number | Required, column number, starting from 0 |
rowIndex | Number | Required, line number, starting from 0 |
value | String\number | Required, value |
VIII. Hyperlink
Note: The following functions are supported in App 9.0 and App 10.0.
1. FR.doHyperlinkByGet function
Function name | Overview | Example |
---|---|---|
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= 2) Click the hyperlink of the CPT cell to open the sub-template and set the title: var url = "/WebReport/ReportServer?reportlet |
FR.doHyperlinkByGetThe parameter description is shown in the following table:
Parameter | Type | Instruction |
---|---|---|
url | Object | 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 |
config | Object | Optional, passed parameter |
target | Object | Optional, the opening position of the hyperlink page |
feature | Object | Optional, the attribute of the opening position of the hyperlink, this attribute is invalid on the mobile terminal |
2. FR.doHyperlinkByPost function
Function name | Overview | Example |
---|---|---|
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"; 2) Click the hyperlink of the CPT cell to open the sub-template and set the title: var url = "/WebReport/ReportServer?reportlet=WorkBook2.cpt"; |
FR.doHyperlinkByPost The parameter description is shown in the following table::
Parameter | Type | Instruction |
---|---|---|
url | Object | 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 |
config | Object | Optional, passed parameter |
target | Object | Optional, the opening position of the hyperlink page |
feature | Object | Optional, 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 | Overview | Example |
---|---|---|
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:
|
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:
|
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:
|
FS.tabPane.addItem The parameter description of the function is shown in the following table:
Parameter | Type | Instruction |
---|---|---|
entry | Object | Required, the entry object corresponding to the Tab item |
「entry」Provided in json format, the attributes are shown in the following table:
Attribute | Type | Instruction |
---|---|---|
title | String,number | The title of the tab page, string and number are all available |
src | String | The address to which the content of the tab page points |
X. Tab component operation
Function name | Overview | Example |
---|---|---|
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:
|
showCardByIndex | showCardByIndex(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:
Note: For specific examples, please refer to: JS Stay on the Current Tab after Clicking Query, JS Click on Hyperlink to Switch TAB Page |
XI. JSON object operation
Overview | operation |
---|---|
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:
|
XII. Other operations
Function name | Overview | Example |
---|---|---|
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 |
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"; |
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){ + 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(); |
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.close | Close 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 | Type | Instruction |
---|---|---|
options | Object | Required, ajax parameter |
[Options] Provided in json format, the attributes are shown in the following table:
Attribute | Type | Instruction |
---|---|---|
url | String | Required, the address to send the request |
data | Object | 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} |
type | String | Request method POST/GET, the default is GET |
dataType | String | 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 |
success | Function | The callback function after the request is successful:
|
error | Function | Call this function when the request fails:
|
complete | Function | Callback function after the request is completed (call after the request succeeds or fails):
|
timeout | Number | Set the request timeout time (milliseconds) |
async | Boolean | The 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 | Type | Instruction |
---|---|---|
code | Object | Required, the function to be called or the code string to be executed |
millisec | Number | The time interval between periodically executing or calling code, in milliseconds |
3. setTimeout Parameter Description
Parameter | Type | Instruction |
---|---|---|
code | Object | Required, the JavaScript code string to be executed after the function to be called |
millisec | Number | The number of milliseconds to wait before executing the code |
4. FR.remoteEvaluateAsync Parameter Description
Parameter | Type | Instruction |
---|---|---|
formula | String | Required, specific formula |
callback | function | Required, the specific callback method, you can get the value calculated by the formula |
XIII. MSG Pop-ups
Function name | Over view | Example |
---|---|---|
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:
Parameter | Type | Instruction |
---|---|---|
title | Object | Required, the title of the message box |
message | Object | Required, the content of the message prompt box |
callback | Object | Optional, 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:
Parameter | Type | Instruction |
---|---|---|
title | Object | Required, the title of the message box |
message | Object | Required, the content of the message prompt box |
callback | Object | Optional, click to confirm the callback function |
min_width | Object | Optional, 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:
Parameter | Type | Instruction |
---|---|---|
title | Object | Required, enter the title of the dialog |
message | Object | Optional, enter the message displayed in the dialog box |
value | Object | Optional, enter the default value of the dialog box |
callback | Object | Optional, click to confirm the callback function |
min_width | Object | Optional, 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(2, 3, message);
} else {
FR.Msg.alert(message);
}
})
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