Browse Source
luckysheet function BREAKING CHANGE: 1. luckysheet.flowdata change to luckysheet.flowdata() 2.all apis list in documentationmaster
13 changed files with 652 additions and 216 deletions
@ -0,0 +1,24 @@ |
|||
# FAQ |
|||
|
|||
## What is the difference between data and celldata in luckysheetfile? |
|||
|
|||
**<span style="font-size:20px;">A</span>**: Use one-dimensional array format [celldata](https://mengshukeji.github.io/LuckysheetDocs/guide/data.html), after the initialization is completed, the data converted into a two-dimensional array format is used for storage and update, and celldata is no longer used. |
|||
|
|||
If you need to take out data as initial data, you need to execute `luckysheet.getGridData(data)` to convert it to celldata data. |
|||
Among them, the celldata in `{ r, c, v }` format is converted to a two-dimensional array using `luckysheet.buildGridData(luckysheetfile)`, and the input parameter is the table data object `luckysheetfile` |
|||
|
|||
Summarized as follows: |
|||
```js |
|||
// data => celldata two-dimensional array data is converted into {r, c, v} format one-dimensional array, the input parameter is two-dimensional data |
|||
luckysheet.getGridData(data) |
|||
|
|||
// celldata => data The two-dimensional array required to generate the table, the input parameter is the table data object file |
|||
luckysheet.buildGridData(luckysheetfile) |
|||
``` |
|||
|
|||
------------ |
|||
## What are the cell types? |
|||
|
|||
**<span style="font-size:20px;">A</span>**: Refer to [Cell Format List](https://mengshukeji.github.io/LuckysheetDocs/guide/format.html), with examples of available cell formats |
|||
|
|||
------------ |
@ -1,125 +1,147 @@ |
|||
# Advanced Features |
|||
|
|||
## luckysheet.getcellvalue(r, c, data, type) |
|||
## luckysheet.create(options) |
|||
- **Parameter**: |
|||
- r: the number of rows in which the cell is located; optional values; integers starting at 0, 0 representing the first row. |
|||
- c: the number of columns in which the cell is located; optional values; integers starting at 0, 0 indicating the first column. |
|||
- data: table data; two-dimensional array; the default value is the current table data. |
|||
- type: cell attribute value; optional value; the default value is'v', which means to get the cell value. |
|||
- {Object} [options]:All configuration information of the table |
|||
- **Usage**: |
|||
|
|||
This method is to get the cell value. When `r` and `c` have no value, return `data`; when `r`, `c` has only one value, return the entire row or column of data; |
|||
Initialize a luckysheet, which can contain multiple worksheets, refer to [Configuration List](https://mengshukeji.github.io/LuckysheetDocs/guide/config.html) |
|||
|
|||
------------ |
|||
## luckysheet.getluckysheetfile() |
|||
- **Usage**: |
|||
|
|||
Return all table data structures. |
|||
|
|||
------------ |
|||
## luckysheet.sheetmanage.getSheetByIndex(index) |
|||
- **Parameter**: |
|||
- index: table subscript; integer starting from 0, 0 means the first table; default is the current table subscript. |
|||
- **Usage**: |
|||
|
|||
Returns a table data structure. |
|||
|
|||
------------ |
|||
## luckysheet.getconfig() |
|||
- **Usage**: |
|||
|
|||
Returns the current table configuration. |
|||
|
|||
------------ |
|||
## luckysheet.getSheetConfig(sheetIndex) |
|||
## luckysheet.getcellvalue([r] [,c] [,data] [,type]) |
|||
- **Parameter**: |
|||
- sheetIndex: table index; an integer starting from 0, 0 means the first table; the default is the current table index. |
|||
- {Number} [r]:The row number of the cell; optional value; an integer starting from 0, 0 means the first row |
|||
- {Number} [c]:The column number of the cell; optional value; an integer starting from 0, 0 means the first column |
|||
- {Array} [data]:Table data, two-dimensional array; optional value; default value is the current table data |
|||
- {String} [type]:Cell attribute value; optional value; the default value is'v', which means to get the actual value of the cell |
|||
- **Usage**: |
|||
|
|||
Return to a table configuration. |
|||
|
|||
This method is to get the value of the cell. |
|||
1. `luckysheet.getcellvalue()`:Return all data in the current worksheet; |
|||
2. `luckysheet.getcellvalue(0)`:Return the first row data of the current worksheet; |
|||
3. `luckysheet.getcellvalue(null,0)`:Return the data in the first column of the current worksheet; |
|||
4. `luckysheet.getcellvalue(0,0)`:Return the v value of the data in the first row and first column of the current worksheet; |
|||
5. `luckysheet.getcellvalue(1,1,null,'m')`: Returns the original value of the cell in the second row and second column of the specified data. |
|||
|
|||
Special case: the cell format is `yyyy-MM-dd`, when the type is'v', the display value of'm' will be mandatory |
|||
|
|||
------------ |
|||
## luckysheet.getvisibledatarow() |
|||
## luckysheet.getluckysheetfile() |
|||
- **Usage**: |
|||
|
|||
Returns the current table row height. |
|||
Returns a one-dimensional array of all table data structures[luckysheetfile](https://mengshukeji.github.io/LuckysheetDocs/guide/data.html), `luckysheet.getluckysheetfile()[0]` can get all the information of the first worksheet. |
|||
|
|||
------------ |
|||
## luckysheet.getvisibledatacolumn() |
|||
## luckysheet.getconfig() |
|||
- **Usage**: |
|||
|
|||
Returns the current table column width. |
|||
Quickly return to the current sheet config configuration, the config information of each worksheet is still contained in the luckysheetfile. |
|||
|
|||
------------ |
|||
## luckysheet.getluckysheet_select_save() |
|||
- **Usage**: |
|||
|
|||
Returns the current selection. |
|||
Returns an array of current selection objects, there may be multiple selections. |
|||
|
|||
------------ |
|||
## luckysheet.getdatabyselection(range, sheetIndex) |
|||
## luckysheet.getdatabyselection([range] [,sheetIndex]) |
|||
- **Parameter**: |
|||
- range: selection object; `object: {row: [r1, r2], column: [c1, c2] }`; the default is the current selection. |
|||
- sheetIndex: table index; an integer starting from 0, 0 means the first table; the default is the current table index. |
|||
- {Object} [range]:Selection object, `object: {row: [r1, r2], column: [c1, c2] }`; optional value; the default is the current first selection. |
|||
- {Number} [sheetIndex]:Table subscript, an integer starting from 0, 0 means the first table; optional value; the default is the current table subscript. |
|||
- **Usage**: |
|||
|
|||
Returns the cell data of a range in a table. |
|||
Returns the data of the first selection in a table. |
|||
- `luckysheet.getdatabyselection()`: Returns the data of the current selection of the current worksheet |
|||
- `luckysheet.getdatabyselection(null,1)`: Returns the data of the current selection of the second worksheet |
|||
|
|||
------------ |
|||
## luckysheet.luckysheetrefreshgrid(scrollWidth, scrollHeight) |
|||
- **Parameter**: |
|||
- scrollWidth: horizontal scroll value. The default is the current horizontal scroll position. |
|||
- scrollHeight: vertical scroll value. The default is the current vertical scroll position. |
|||
- {Number} [scrollWidth]:Horizontal scroll value. The default is the current horizontal scroll position. |
|||
- {Number} [scrollHeight]:Vertical scroll value. The default is the current vertical scroll position. |
|||
- **Usage**: |
|||
|
|||
Refresh canvas display data according to scrollWidth, scrollHeight. |
|||
Refresh the canvas display data according to scrollWidth and scrollHeight. |
|||
|
|||
------------ |
|||
## luckysheet.setcellvalue(r, c, d, v) |
|||
- **Parameter**: |
|||
|
|||
- r: the number of rows in which the cell is located; an integer starting from 0, 0 means the first row. |
|||
- c: the number of columns in which the cell is located; an integer starting from 0, 0 means the first column. |
|||
- d: table data; two-dimensional array. |
|||
- v: The value to be set; it can be an object, and the object should conform to the cell object format. |
|||
- {Number} [r]:The row number of the cell; an integer starting from 0, 0 means the first row. |
|||
- {Number} [c]:The column number of the cell; an integer starting from 0, 0 means the first column. |
|||
- {Array} [d]:Table data; optional value; two-dimensional array. |
|||
- {Object | String | Number} [v]:The value to be set; it can be an object, and the object is to conform to the cell object format. |
|||
- **Usage**: |
|||
|
|||
Set the value of a cell. Cooperate with `luckysheet.luckysheetrefreshgrid()` to refresh to see the cell value changes. |
|||
Set the value of a cell. Can be used with `luckysheet.luckysheetrefreshgrid()` to refresh and view cell value changes. |
|||
```js |
|||
luckysheet.setcellvalue(0, 0, luckysheet.flowdata, 'abc'); |
|||
luckysheet.luckysheetrefreshgrid(); |
|||
luckysheet.setcellvalue(0, 0, luckysheet.flowdata(), 'abc'); |
|||
luckysheet.jfrefreshgrid(); |
|||
``` |
|||
|
|||
------------ |
|||
## luckysheet.jfrefreshgrid() |
|||
- **Usage**: |
|||
|
|||
Refresh canvas |
|||
|
|||
------------ |
|||
## luckysheet.setluckysheet_select_save(v) |
|||
- **Parameter**: |
|||
- v: The selection value (array) to be set. It conforms to the selection format rules, such as `[{ row: [r1, r2], column: [c1, c2] }]`. |
|||
- {Array} [v]:The selection value (array) to be set. Comply with selection format rules, such as `[{ row: [r1, r2], column: [c1, c2] }]`. |
|||
- **Usage**: |
|||
|
|||
Set the value of the current table selection. With `luckysheet.selectHightlightShow()`, you can view the selection changes on the interface. |
|||
Set the value of the current table selection area. With `luckysheet.selectHightlightShow()`, you can view the selection changes in the interface. |
|||
```js |
|||
luckysheet.setluckysheet_select_save([{ row: [0, 1], column: [0, 1] }]); |
|||
luckysheet.selectHightlightShow(); |
|||
``` |
|||
|
|||
------------ |
|||
## luckysheet.sheetmanage.setSheetHide(index) |
|||
## luckysheet.selectHightlightShow() |
|||
- **Usage**: |
|||
|
|||
Highlight the current selection |
|||
|
|||
------------ |
|||
## luckysheet.setSheetHide(index) |
|||
- **Parameter**: |
|||
- index: table subscript; integer starting from 0, 0 means the first table; default is the current table subscript. |
|||
- {Number} [index]:Table index; an integer starting from 0, 0 means the first table; the default is the current table index. |
|||
- **Usage**: |
|||
|
|||
Hide a table. |
|||
|
|||
------------ |
|||
## luckysheet.sheetmanage.setSheetShow(index) |
|||
## luckysheet.setSheetShow(index) |
|||
- **Parameter**: |
|||
- index: table subscript; integer starting from 0, 0 means the first table; default is the current table subscript. |
|||
- {Number} [index]:Table index; an integer starting from 0, 0 means the first table; the default is the current table index. |
|||
- **Usage**: |
|||
|
|||
Display a table. |
|||
|
|||
------------ |
|||
## luckysheet.method.destroy() |
|||
## luckysheet.flowdata() |
|||
- **Usage**: |
|||
|
|||
Quickly get the data of the current table |
|||
|
|||
------------ |
|||
## luckysheet.buildGridData(file) |
|||
- **Parameter**: |
|||
- {Object} [file]:[luckysheetfile](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/data.html#%E8%8E%B7%E5%8F%96%E8%A1%A8%E6%A0%BC%E6%95%B0%E6%8D%AE) |
|||
- **Usage**: |
|||
|
|||
Generate a two-dimensional array that the table can recognize |
|||
|
|||
------------ |
|||
## luckysheet.getGridData(data) |
|||
- **Parameter**: |
|||
- {Array} [data]:Two-dimensional array data of worksheet |
|||
- **Usage**: |
|||
|
|||
Convert two-dimensional array data into `{r, c, v}` format one-dimensional array |
|||
|
|||
------------ |
|||
## luckysheet.destroy() |
|||
- **Usage**: |
|||
|
|||
Release table |
|||
Delete and release table |
|||
|
Loading…
Reference in new issue