I. Overview
If there is an operation of inserting and deleting records when data entry, then you need to click the button to insert a blank record or delete an existing record. FineReport provides 2 methods for setting the insert and delete buttons, which are as follows:
Built-in insert and delete button (does not support mobile terminal)
Customize insert and delete buttons (support mobile terminal)
II. Built-in insert and delete button
1. Design data entry template
1) Create a new database query data set ds1, and the SQL statement is: select * from sales
2) Design the data entry form, add text widgets to A2-D2 cells, and drag the data set fields into the corresponding cells, as shown in the following figure:
3) In the designer menu bar, click Template > Data Entry Attributes to add a built-in SQL submission, as shown in the following figure:
2. Setting insert and delete button
Select Template > Web Attributes from the menu bar of the designer, and select Data Entry Settings > Individually set for the template. Double click to add the Insert record and delete record buttons to the top toolbar, as shown in the figure below
3. Effect preview
Save the template, click data entry preview, and the insert and delete operations are shown in the following figure:
insert record
Delete record
Note: the mobile terminal does not support the insert and delete buttons in the toolbar. Please use the method of user-defined insert and delete buttons below to fill in the mobile terminal.
III. User defined insert delete button
1. Design data entry template
1) Create a new database query data set ds1, and the SQL statement is: select * from sales
2) Design the data entry form, add text widgets to A2-D2 cells, and drag the data set fields into the corresponding cells, as shown in the following figure:
3) In the designer menu bar, click Template > Data Entry Attributes to add a built-in SQL submission, as shown in the following figure:
2. Setting the insert row button
Select E2 cell, add a Button widget to the cell, select the Insert row from the button type drop-down list, and set the Specified cell to A2, as shown in the following figure:
The property settings of the insert row button are described in the following table:
Button Type | Property | Description |
---|---|---|
Insert line | Button name | The text information displayed by the button in the front display. The default is insert line |
Button icon | The icon displayed in front of the button name. The default is the green plus sign | |
Shortcut key | not supported at present | |
Specify cell | To decide which data entry cell to start adding records, it must be one of the extensible filling cells. For example, in the example, it can only be one of A2 ~ D2 | |
Number of rows | After clicking the insert row button, the number of blank record rows that can be added at one time is 1 by default |
3. Set delete line button
Select the F2 cell, add a Button widget to the cell, select Delete row from the button type drop-down list, and set the specified cell to A2, as shown in the following figure
The attributes settings of the Insert Row button are described in the following table:
Button type | Attributes | Instruction |
---|---|---|
delete row button | button name | The text information displayed by the button when the front end is displayed, the default is: delete row |
button icon | The icon displayed before the button name, the default is a red cross | |
hot key | Shortcut key settings are currently not supported | |
specified cell | Specifies which cell is the parent to delete, the cell must be set to expandable |
Note: The submit event cannot be set in the delete row button, there will be a logic conflict problem. If you want to set it, you have to use the normal buttons.
4. Effect preview
Save the template, click data entry preview, and the insert and delete operations are shown in the following figure:
Insert record
Delete record
2) Mobile terminal
At the same time, it supports filling in the App and H5 ends, and the effect is shown in the following figure:
IV. Template download
1. Built-in insert and delete button
Completed template, please refer to %fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\DataEntry\DataEntryApplication\Builtincpt
Click download template:
2. Custom insert and delete button
Completed template, please refer to %fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\DataEntry\DataEntryApplication\Button.cpt
Click download template: