- SpreadJS Overview
- Getting Started
- JavaScript Frameworks
- Best Practices
-
Features
- Workbook
- Worksheet
- Rows and Columns
- Headers
- Cells
- Data Binding
- TableSheet
- GanttSheet
-
ReportSheet
-
Template Sheet Settings
- Set Template Cell Type
- Set Spill Mode
- Apply Cell Expansion
- Set Spill Direction
- Set Pin
- Set Cell Context
- Set Filter Condition
- Sort Cell Data
- Auto Fit Template Cell
- Change Cell Styles
- Apply Conditional Formatting
- Add Data Validation
- Change Cell States
- Add Show/Collapse Button
- Show Hidden Row and Col
- ReportSheet Formula Functions
- Configure Data Entry Settings
- Set Pagination
- Configure Layout Settings
- Add Picture Shape
- Report Sheet Settings
- Report Sheet Data Entry Support
- Report Sheet Data Charts
-
Template Sheet Settings
- Data Charts
- JSON Schema with SpreadJS
- SpreadJS File Format
- Data Validation
- Conditional Formatting
- Sort
- Group
- Formulas
- Serialization
- Keyboard Actions
- Shapes
- Floating Objects
- Barcodes
- Charts
- Sparklines
- Tables
- Pivot Table
- Slicer
- Theme
- Culture
- AI Assistant
- SpreadJS Designer
- SpreadJS Designer Component
- SpreadJS Collaboration Server
- Touch Support
- Formula Reference
- Import and Export Reference
- Frequently Used Events
- API Documentation
- Release Notes
Configure Data Entry Settings
Reportsheet supports data entry through the integration with the DataManager. You need to configure the association between specific cells, columns, and tables in the data entry settings of the TemplateSheet.
To configure the data entry settings in the TemplateSheet, follow the below steps:
Add Table in DataManager.
Configure the remote information for the added table to establish a connection.
Design the template sheet according to your requirements, incorporating the necessary cells for data entry.
Configure
TemplateCellinformation in theTemplateSheetclass.You can also set the
defaultValueproperty inTemplateCellto generate a default value for newly added records of the report sheet. Note thatdefaultValueis a Formula.Use the
setDataEntrySettingmethod of theTemplateSheetclass to configure the data entry settings.Configure the primary key fields in the write-back rule.
You can use the following code sample to configure the data entry settings and generate a default value for the newly added record.
const columns = ['Id', 'Region', 'Salesman', 'Product', 'Sales'];
columns.forEach((columnName, i) => {
templateSheet.setTemplateCell(3, i, {
type: "List",
binding: `Sales[${columnName}]`,
// Generate a random UUID when a new row is inserted for "Id" Column
defaultValue: i === 0 ? '=SJS.UUID()' : undefined // Default Value
})
})
// Configure Data Entry Settings.
const salesRule = {
name: "test1", // string
tableName: "Sales", // string
fields: [ // {formula, dbColumnName, isPrimary}
{ formula: 'A4', dbColumnName: 'Id', isPrimary: true },
{ formula: 'B4', dbColumnName: 'Region' },
{ formula: 'C4', dbColumnName: 'Salesman' },
{ formula: 'D4', dbColumnName: 'Product' },
{ formula: 'E4', dbColumnName: 'Sales' }
],
skipRecordWithEmptyValue: true,
includeUnmodified: true
}
// setDataEntrySetting(dataEntrySetting: GC.Spread.Report.DataEntrySetting)
templateSheet.setDataEntrySetting([salesRule]);
reportSheet.refresh();