Overview
Function Description
If you need to insert or delete records during the data entry, click the button to insert a blank record or delete an existing one. FineReport provides two methods to set the insertion and deletion buttons, as shown in the following figures.
Built-in insertion and deletion buttons (not supported on mobile terminals).
Customized insertion and deletion buttons (supported on mobile terminals).
Built-in Insertion and Deletion Buttons
This solution does not support mobile preview. If you have requirements for mobile terminals, do not use this solution.
Data Entry Template Designing
1. Create a database query dataset named ds1 and enter the SQL statement SELECT * FROM Sales.
2. Design the data entry table, add text widgets to cells A2 to F2, and drag the dataset fields into the corresponding cells, as shown in the following figure.
3. Choose Template > Data Entry Attribute on the menu bar and add a built-in SQL submission, as shown in the following figure.
Insertion/Deletion Button Setting
Choose Template > Web Attribute on the menu bar. On the opened page, choose Data Entry Setting > Set for This Template Separately. Double-click the Insert Record and Delete Record buttons to add them to the top toolbar, as shown in the following figure.
Effect Display
Save the template and click Data Entry Preview. The following figures show how to insert and delete records.
Record Insertion
Record Deletion
1. Through this method, you can insert or delete a record using the cell where your cursor hovers as the parent cell. Therefore, ensure that the cursor hovers over the correct cell before you click the button.
2. This solution does not support mobile preview. If you have requirements for mobile terminals, do not use this solution.
Insert/Delete Button Customization
Data Entry Template Designing
1. Create a database query dataset named ds1 and enter the SQL statement SELECT * FROM Sales.
2. Design the data entry table, add text widgets to cells A2 to F2, and drag the dataset fields into the corresponding cells, as shown in the following figure.
3. Choose Template > Data Entry Attribute on the menu bar and add a built-in SQL submission, as shown in the following figure.
Row Insertion Button Setting
Select cell G2, add a button widget to the cell, set Button Type to Insert Row and Specified Cell to A2, and leave the left settings as default values, as shown in the following figure.
The following table describes attribute settings for the Insert Row button.
Button Type | Attribute | Description |
---|---|---|
Insert Row button | Button Name | Text information (Insert Row by default) displayed on the button during the front end display. |
Button Icon | Icon (green plus sign by default) displayed in front of the button name. | |
Shortcut Key | Shortcut key setting, which is not supported currently. | |
Specified Cell | Cell to be specified as the parent cell to insert rows. This cell must be set to be expandable. | |
Number of Rows | Number of rows (1 by default) that can be inserted each time when you click the insertion button. |
Delete Row Button Setting
Select cell H2, add a button widget to the cell, set Button Type to Delete Row and Specified Cell to A2, and leave the left settings as default values, as shown in the following figure.
The following table describes attribute settings for the Delete Row button.
Button Type | Attribute | Description |
---|---|---|
Delete Row button | Button Name | Text information (Delete Row by default) displayed on the button during the front end display. |
Button Icon | Icon (red cross sign by default) displayed in front of the button name. | |
Shortcut Key | Shortcut key setting, which is not supported currently. | |
Specified Cell | Cell to be specified as the parent cell to delete rows. This cell must be set to be expandable. |
Effect Display
PC
Save the template and click Data Entry Preview. The following figures show how to insert and delete records.
Record Insertion
Record Deletion
Mobile Terminal
The function is also supported on the DataAnalyst app and H5 terminals, as shown in the following figure.
Template Download
Built-in Insertion and Deletion Buttons
You can download the template: Built-in Insertion and Deletion Buttons.cpt.
Custom Insertion and Deletion Buttons
You can download the template: Custom Insertion and Deletion Buttons.cpt.
Notes
1. Row insertion/deletion will trigger a recalculation of all the formulas on the page, resulting in a refresh effect. Therefore, row insertion/deletion will also be slower if the page loads slowly (caused by operations such as the enabling of the Display Widget Directly function or using of SQL functions). In this case, you can suffix the URL with the parameter &async_insert=true to enable partial refresh after inserting rows, accelerating row insertion regarding large amounts of data.
2. Row insertion/deletion will trigger the after-the-load event of the page.
3. The row insertion strategy will affect the values of the cells in the inserted row.
4. When you insert or delete rows, the real-time calculation effect of hierarchical coordinate functions is not supported.