10 KiB
FAQ
Q What is the difference between data and celldata in luckysheetfile?
A: Use one-dimensional array format celldata, 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:
// 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)
Q What are the cell types?
A: Refer to Cell Format List, with examples of available cell formats
## Q How to use Luckysheet in Vue/React project?
A:
- Vue case: luckysheet-vue
- React case: luckysheet-react
Q Why will the formula in the table not be triggered after initialization?
A : Refer to Table data format ,just set the calcChain corresponding to the cell data.
Q Is the remote loading data loadUrl or updateUrl?
A: loadUrl. Configure loadUrl, Luckysheet will request the entire table data through ajax, and updateUrl will be used as the interface address for collaborative editing in real-time saving. Note: Initial data needs to be configured with loadUrl and loadSheetUrl parameters, while for collaborative editing, the four parameters of loadUrl, loadSheetUrl, updateUrl and allowUpdate can be configured to take effect.
Q What is the difference between index
and order
for each sheet page?
A: Each sheet page has a unique id, which is index
, which can be incremented by numbers or a random string. And order
is the sorting situation of all sheets, starting from 0, can only be numbers 0,1,2...
.
Q Why can’t I run the project directly under the dist folder?
A: Need to start the local server
Q How to import and export excel?
A: The excel import and export library developed with Luckysheet-Luckyexcel has realized the excel import function, and the export function is under development. You can refer to this blog post for excel export at this stage: https://www.cnblogs.com/recode-hyh/p/13168226.html.
Q How to merge cells during initialization?
A: Refer to the following case
- Luckysheet initializes data with merged cells: https://www.cnblogs.com/DuShuSir/p/13272397.html
Q How does 'Luckysheet' save the data from the table to the database? Is there a soulution for storage and collaboration?
A :There are two options:
-
- after the table operation is completed, you can use
luckysheet.getAllSheets()
to get all sheet data that stroed in the back-end.
- after the table operation is completed, you can use
-
- enable the collaborative editing function to transmit data to the back-end in real-time. refer this article:https://www.cnblogs.com/DuShuSir/p/13857874.html
Q How to monitor cell hover or click events? how to monitor cellRenderAfter
in real-time?
A :我们搜集到需要针对单元格事件的二次开发需求,规划了单元格相关的钩子函数,参考单元格钩子函数(显示的TODO的暂未开放)
Q How to customize the top toolbar?
A : reference: options.showtoolbarconfig(TODO means waiting to developed)
Q Does the project use jQuery?
A :yes. At the beginning, Luckysheet uses jQuery。The packaging tool will package the jQuery to this file ./plugins/js/plugin.js
If your project (such as react / Vue) also references jQuery globally and causes conflicts, you can try to remove a jQuery.
if you want to remove jQuery in Luckysheet
, you can find jQuery
in source code folder gulpfile.js
:src/plugins/js/jquery.min.js,then delete information related to jQuery.
Q How to add a field to a cell object?
A reference cell object format,then read this annotationsrc/controllers/postil.js。the annotation is a configuration in a cell object.
Q The toolbar icon is on the loading stage all the time.
A The luckysheet use iconfont icon in this project, if any icon cannot be loaded ,plz check your iconfont.css. we are so sorry that we did not describe it clearly in the old version documents.
Now the documents have been updated.official documents
Q Can't run Luckyexcel after package.
A Terminal does not show end
, but if the dist
folder has this file luckyexcel.js
, it is normal.
Lucky excel is an excel import and export library. The project uses gulp
as a packaging tool. There is a problem with the old version of the packaging tool, but it is fixed now. if this problem still troubles you, plz check the following steps:
- pull the latest code.
npm i
npm run build
more information:Luckyexcel
Q How to disable editing of cells?How to open sheet protection?
A Sheet protection includes disable editing of cells that you need to make some configurations on each sheets. config.authority
, the latest configurationssheet protection。
In order to make it easier for you to understand the function of sheet protection, the following video shows how to make the whole sheet uneditable, but allow a column of cells to be edited:
In you local browser, you can open the control pannel, use luckysheet.getLuckysheetfile()[0].config.authority
to get the configuration parameters.
Q How to configure data validation?
A there is the configuration of data validation,data validation。Also there is the API that you can use data validation
in any time. setDataVerification.
Q Is there a case for using Luckysheet with CDN?
A Luckysheet supports CDN. reference:The case of using luckysheet by CDN
Q how to limit the adaptive height of a picture in a cell?
A First of all, you need to move the picture and adjust the cell size, and then there are the following situations:
- if the cell contains a picture and you expand the cell, the picure will not be expanded.
- if the cell contains a picture and you shorten the cell to the edge of the picture, the picture will shrink.
- When the picture exceeds the border of the cell, the size of this picture will change with the size of the cell.
if you want to get the position of the picture, you can overlap the picture with the border of the cell.(in the source code, it needs to overlap more than 2px.)The following demo video shows how to limit the image to the adaptive width and height of the cell.
Q How to get the default row height and column width of the worksheet?
A There are two ways to get it
-
- use
luckysheet.getLuckysheetfile()
to get all configuration data, so you can get thedefaultRowHeight
anddefaultColWidth
in the sheet configuration data。
- use
-
- use API to get the default row height getDefaultRowHeight and column width.getDefaultColWidth