I. Mobile H5 supports calling JS
Web event | Pagination Preview |
---|---|
Load start event | √ |
Load end event | √ |
Widget event | Parameter widget | Dashboard widget |
---|---|---|
After initialization | √ | √ |
Before editing | ||
After editing | √ | |
End of edit | √ | |
Click on | √ | √ |
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 widget , but does not support the initialization of the parameter panel
Note 3: The component does not support click events.
II. Object
Function name | Overview | Scope of use | 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 widget 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 objectcontentPane,supportcontentPaneAll supported methods under 2) In FRM, _g() is the entire form objectglobalForm,supportglobalFormAll supported methods under | 1) The parameter interface widget event in CPT/FRM can pass_g().parameterCommit()Realize automatic query 2) In the cell widget event reported in the CPT, you can pass_g().verifyAndWriteReport()And other reporting methods to achieve submission and storage 3) The report block and icon block events in FRM can pass_g().options.formGet the object in the body of the form 4) Get the FRM main widget : _g().options.form.getWidgetByName("name") | |
parameterEl | Get the parameter panel widget : parameterEl.getWidgetByName("name") The parameter interface in CPT and FRM are bothparameterEl: 1) Passed in CPTcontentPane.parameterElTo get the parameter interface, it is mainly used in the loading start and end events of Web events in CPT, and in CPT cell JS 2) Passed in FRM_g().parameterElTo get the parameter interface, it is mainly used in the body initialization event of FRM, the widget in the FRM body, the report block cell/chart JS of the FRM body, and the chart block JS | Get the value of the parameter interface widget in the CPT loading end event: var a = contentPane.parameterEl. | |
this | In the event of the widget, you can passthisGet the current widget object directly | widget refers to the widgetin the reporting cell, the widget in the parameter interface, and 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: var a = this.getValue(); |
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 2) For each widgetoptionsThere is the current form object FORM Therefore, in the event of the parameter interface or the widget of the form body, passthis.options.formTo getcurrentForm object | Get the CPT/FRM parameter panel widget, get the FRM main widget: this.options.form.getWidgetByName("name") |
III. Attributes
Function name | Overview | Example | |
---|---|---|---|
reportTotalPage | 1)contentPaneThe properties under the report object, the total number of pages of the current report 2) OnlyPaginationWhen the attribute will have a value, passcontentPane.reportTotalPageTo make a call 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
Function name | Overview | Example |
---|---|---|
parameterCommit() | 1) Query operation, whether it is CPT or FRM, there will be a built-in query button on the parameter interface, and the user can trigger the query operation through JS instead of the built-in query 2) Pass contentPane.parameterCommit() or_g().parameterCommit()Triggered in two ways, only through _g().parameterCommit() Way to trigger | 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 thanthe end month!") } else { 2) The query is triggered in the click event of the custom button in the FRM parameter interface: _g().parameterCommit(); |
V. Page turning operation
Function name | Overview | Example | |
---|---|---|---|
gotoFirstPage() | 1)contentPaneA method under the report object, used to jump to the first page of the report 2) OnlyPaginationThis method will be useful only whencontentPane.gotoFirstPage()To make a call 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)contentPaneA method under the report object to jump to the last page of the report 2) This method is only useful when paging, throughcontentPane.gotoLastPage()To make a call 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)contentPaneA method under the report object to jump to the previous page of the current page 2) OnlyPaginationThis method will be useful only whencontentPane.gotoPreviousPage()To make a call 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)contentPaneA method under the report object to jump to the next page of the current page onlyPaginationThis method will be useful only whencontentPane.gotoNextPage()To make a call 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
Function name | Overview | Example | |
---|---|---|---|
getValue() | 1) The value method of the widget 2) Obtain the widget, for example, the obtained widgetvariable isWidget, Then you can passWidget.getValue()To get the value of the widget 3) If the widgetis a drop-down box, etc., there is a distinction between the displayed value and the actual value,getValue()Take isActual value | 1) Get the value of the current drop-down box and the values of other widget in the edit end event of the drop-down box of the CPT parameter interface:
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 widget:
| |
setValue(value) | 1) Assignment method of widget 2) Obtain the widget, for example, the obtained widgetvariable isWidget, Then you can passWidget.setValue(value)To set the value of the widget. 3) If the widget is a drop-down box, etc., there is a distinction between the displayed value and the actual value,setValue()Set isActual value 4) The parameter description is as follows: Parameters: value Parameter type: Object Parameter description: value | Assign values to other widget in the CPT parameter interface button click event:
| |
getText() | 1) Take the display value of the widget 2) Obtain the widget, for example, the obtained widget variable isWidget,able to passWidget.getText()To get the display value of the widget 3) Only the five widgetof 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 are usedgetValue()What is obtained is the actual value,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()andgetText()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:
| |
reset() | 1) Clear the data of the widget 2) Obtain the widget , for example, the obtained widget variable isWidget, Then you can passWidget.reset()To clear the data of the widget | After clicking the button on the CPT parameter interface, the other widget on the parameter interface will be uniformly reset:
| |
isVisible() | 1) Determine whether the widget is visible 2) Obtain the widget, for example, the obtained widget variable isWidget, Then you can passisVisible()To determine whether the widget is visible. Return if visibletrue, Return if not visiblefalse | Judge whether the widget is visible after clicking the button on the CPT parameter interface:
| |
setEnable(enable) Note 1: The use of reporting cells is not supported Note 2: It is not supported to widget the properties in the cell through the parameter panel | 1) Set whether the widget is available 2) Obtain the widget, for example, the obtained widget variable isWidget, Then you can passWidgeti.setEnable(enable)To set whether the widgetis available 3) The parameter description is as follows: Parameters: 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, whether widget b is available, when a is selectedJiangsuWhen the widget b is available; when the value of aShanghaiWhen, widget b is unavailable:
| |
isEnabled() | 1) Determine whether the widgetis available 2) Get the widget, for example, the widget variable we get isWidget, Then you can passisEnabled()To determine whether the widget is available 3) True if available, false if not available | Judge whether the widget is visible after clicking the button on the CPT parameter interface:
| |
fireEvent(eventName) | 1) Trigger the widget event with the specified name 2) Obtain the widget , for example, the obtained widget variable isWidget, Then you can passfireEvent(eventName)To trigger events of the widget 3) The parameter description is as follows: Parameters: eventName Parameter type: String Parameter description: the name of the event to be triggered | The click event that triggers the built-in query button in the edit end event of the CPT parameter interface drop-down box:
| |
contentPane.getWidgetByCell("cell") | Get the widget according to the location of the cell where the widget is located The parameter is the cell name |
VII. Hyperlink
1. FR.doHyperlinkByGet function
Function name | Overview | Example |
---|---|---|
FR.doHyperlinkByGet | Hyperlink, tool methods under FR can be passedFR.doHyperlinkByGet(url,config,target,feature)Call it anywhere you can write JS | Click on the hyperlink of the CPT cell to open the sub-template and pass the parameters:
|
FR.doHyperlinkByGet The parameter description is shown in the following table:
parameter | type | instruction |
---|---|---|
url | Object | Required, url or Json hyperlink definition, url support Absolute path such ashttp://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 parameters |
target | Object | Optional, the opening position of the hyperlink page |
feature | Object | Optional, the attribute of the opening position of the hyperlink, this attributeMobile terminal is invalid |
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 anywhere you can write JS | Click on the hyperlink of the CPT cell to open the sub-template and pass the parameters:
|
FR.doHyperlinkByPost The parameter description is shown in the following table:
parameter | type | instruction |
---|---|---|
url | Object | Required, URL or Json hyperlink definition The absolute path is like:http://192.168.100.1:8080/WebReport/ReportServer?reportlet=WorkBook2.cpt Relative paths such as: /WebReport/ReportServer?reportlet=WorkBook2.cptOr ReportServer?reportlet=WorkBook2.cpt |
config | Object | Optional, passed parameters |
target | Object | Optional, the opening position of the hyperlink page |
feature | Object | Optional, the attribute of the opening position of the hyperlink, this attributeMobile terminal is invalid |
VIII. Platform Operation
Function name | Overview | Example |
---|---|---|
FS.tabPane.closeActiveTab | 1) Close the current Tab option page 2) Can passwindow.parent.FS.tabPane.closeActiveTab()Call 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) Can passFR.logoutApp()Call it anywhere you can write JS 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) Can passwindow.parent.FS.tabPane.addItem(entry)Call 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:
Note: "title" is only supported in the App, not in the browser. |
Note: FR.logoutApp will be invalid in the report parsed by H5 in the App, and will not return to the login interface of the App; when used in H5, such as WeChat, logout can be triggered.
FS.tabPane.addItem The parameter description of the function is shown in the following table:
Parameter | Type | Instruction |
---|---|---|
entry | Object | Required, entry object corresponding to Tab item |
Entry withJsonThe format is provided, and the attributes are shown in the following table:
Attributes | 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 |
IX. Tab component operation
getShowIndex | pass throughgetShowIndexGet the Tab number currently displayed by the Tab component | Refer toshowCardByIndex Function example |
setTabVisible | 1) PasssetTabVisible(tabName String, isVisible Boolean)Can hide part of Tab title 2)Parameter 1The instructions are as follows: Parameter 1: tabName Parameter 1 type: String Description of Parameter 1: Required, Tab widget name, such as Tab0 3)Parameter 2The description is shown in the figure below: Parameter 2: isVisible Parameter 2 type: Boolean Description of parameter 2: Required, whether the tab is visible,turevisible/falsehide Note: Cannot be used in the initialization event and parameter interface of tablayout | Different users can see different Tabs:
|
showCardByIndex | showCardByIndex(Number:cardID); Effect: Jump to the specified Tab block can be realized Parameters: cardID Description: required, the displayed Tab number, starting from 0 showCardByIndex(Number: cardID, Boolean: animated); Effect: Added an animated parameter to widget 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 Parameters: 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 within a fixed time interval:
Note: For specific examples, please refer to JS Click on Hyperlink to Switch TAB Page |
X. JSON Object Operations
Overview | Example |
---|---|
Some requests or methods return JSON data, able to passjson.nameTo get the value of the name attribute | Pass in cell JSFR.Mobile.getDeviceInfoObtain device information, and take out the Model device model in it:
|
XI. Other operations
Function name | Overview | Example |
---|---|---|
FR.cjkEncode | 1) Perform special encoding conversion on Chinese, Japanese and Korean, and return the converted string to passFR.cjkEncode(Object text)Call, generally cooperate with Hyperlink JS to transcode Chinese characters in Hyperlink to prevent garbled characters 2) The parameter description is as follows: Parameters: text Parameter type : Object Parameter description : required, string to be encoded | Hyperlink to Chinese name template in CPT cell Hyperlink JS:
|
FR.cjkDecode | 1) Convert the string processed by cjkEncode into the original string and passFR.cjkDecode(Object text)Make a call 2) The parameter description is as follows: Parameters: text Parameter type: Object Parameter description: required, the string to be decoded | Use it first in CPT cell hyperlink JSFR.cjkEncodeEncode Chinese, and then useFR.cjkDecodeTo decode:
|
FR.ajax | 1) PackagedjQuery.ajax()Function, the data parameter has been encoded in Chinese, Japanese and Korean, which can be passedFR.ajax(options)Call it wherever JS can be used 2) Refer to chapter 12.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"; |
setInterval | 1)setInterval() The method can call the function or calculate the expression according to the specified period (in milliseconds) 2)setInterval() The method will keep calling the function until clearInterval()Is called or the window is closed. Depend onsetInterval()The ID value returned can be used asclearInterval()Method parameters 3) PasssetInterval(code,millisec)Make a call 4) For parameter description, please refer to chapter 12.2 of this article | 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. pass throughsetTimeout(code,millisec)Make a call 2) For parameter description, please refer to chapter 12.3 of this article Note: The JS code issetTimeout(function(){})When formatting, "this" needs to be used outside the declaration | 1) A prompt will pop up 3s after the report loading end time:
2) A prompt will pop up 3s after the report loading end time:
|
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: |
window.close | Close the current window | Write JS in the report success event, and close the template after the report is successful and return to the directory:
|
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 parameters, respectively representing: 1) formula: required, specific formula 2) callback: required, the specific callback method, you can get the value calculated by the formula |
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 https, enterprise WeChat, and Dingding 2) Function usage FR.location(function(status, message){...}) 3) Matters needing attention If you want to use it in corporate 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.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 cell | FR.cellStr2ColumnRow('B1') The return value is {"col":1,"row":0} |
1. FR.ajax parameter description
FR.ajax The parameter description of the function is shown in the following table:
Parameter | Type | Instruction |
---|---|---|
options | Object | Required, ajax parameter |
[Options] withJsonThe format is provided, and the attributes are shown in the following table:
Attributes | 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 Value must beKey/ValueThe format can be a string such asp1=pavalue&p2=p2value, Or an object such as{p1:p1value,p2:p2value} |
type | String | Request method POST/GET, the default isGET |
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: return a plain text string jsonp: jsonp method used 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 istrue, All requests are asynchronous requests. If you need to send a synchronization request, set this option tofalse |
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 |
XII. MSG popup
Function name | Overview | Example |
---|---|---|
FR.Msg.alert | 1) A prompt dialog box with a pop-up message able to passFR.Msg.alert(Object title, Object message[, Object callback])Call it anywhere you can write JS 2) For parameter description, please refer to chapter 13.1 of this article | 1) After clicking the fill in cell button, a prompt pops up:
2) After clicking the fill in cell button, a prompt will pop up, and it will automatically close after 2s:
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.toast | 1) A floating reminder pops up, disappears automatically in 5s, you can passFR.Msg.toast(Object message)Call it anywhere you can write JS 2) The parameter description is as follows: Parameters: 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.confirm | 1) The pop-up confirmation dialog box accessibleFR.Msg.confirm(Object title, Object message[,Object callback, Object min_width ])Call it anywhere you can write JS 2) For parameter description, please refer to chapter 13.2 of this article | 1) After clicking the fill in cell button, a confirmation box will pop up:
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.prompt | 1) The pop-up input dialog box able to passFR.Msg.confirm(Object title, Object message, Object value, Object callback, Object min_width)Call in any place where js can be written 2) For parameter description, please refer to chapter 13.3 of this article | 1) After clicking the fill in cell button, an input box will pop up: 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:
|
1. FR.Msg.aler parameter description
FR.Msg.aler The parameter description of the function 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 The parameter description of the function 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
FR.Msg.prompt The parameter description of the function 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 |
XIII. Matters needing attention
WeChat DingTalk provides partial support for the JS interface developed by a third party.