I. Overview
1.1 Problem description
For the Data Entry template, it is hoped that the data of a certain cell will be multiple values of a certain column in the database table (the same value may appear multiple times), and the display order can be customized. For example, the values in the database are 'A','B' ,'C' and 'D', and it is hoped that 'A, B, A' will be displayed in the text box, with the effect shown below. How to achieve this?
1.2 Implementation ideas
Add a post-edit event to the drop-down box widget, so that every time a value is selected in the drop-down box, the value is spliced to the original content of the text box.
You will learn |
---|
|
II. Examples
2.1 Template design
Add a drop-down box widget and a text widget, as shown below:
2.2 Set the data dictionary of the drop-down box
2.3 Add a post-edit event
Add a post-edit event for the drop-down box widget
The specific JS code is as follows:
var value=this.getValue();//get current value
var text=contentPane.curLGP.getCellValue("B2");
//get the value of the text widget cell
if(value!=""){
if(text == "" || text == null){
//if text widget value is null, assign the current value to text widget cell
contentPane.setCellValue("B2",null,value);
}else{//if the text widget has value, append it with old value
contentPane.setCellValue("B2",null,text+","+value);
}
}
2.4. Preview
Save the template, click Data Entry Preview, and the effect on PC terminal is as follows:
Note: In our testing, the mobile terminal does not support this JS.