chore: openui5 row-cols removed
This commit is contained in:
parent
8ccd589fc3
commit
a488cdab0f
@ -512,35 +512,6 @@ will generate a workbook that can be opened in a spreadsheet editor.
|
||||
|
||||
</details>
|
||||
|
||||
### Rows and Columns
|
||||
|
||||
Some data grids and UI components split worksheet state in two parts: an array
|
||||
of column attribute objects and an array of row objects. The former is used to
|
||||
generate column headings and for indexing into the row objects.
|
||||
|
||||
The safest approach is to use an array of arrays for state and to generate
|
||||
column objects that map to A1-Style column headers.
|
||||
|
||||
The [React Data Grid demo](/docs/demos/grid/rdg#rows-and-columns-state) uses
|
||||
this approach with the following column and row structure:
|
||||
|
||||
```js
|
||||
/* rows are generated with a simple array of arrays */
|
||||
const rows = utils.sheet_to_json(worksheet, { header: 1 });
|
||||
|
||||
/* column objects are generated based on the worksheet range */
|
||||
const range = utils.decode_range(ws["!ref"]||"A1");
|
||||
const columns = Array.from({ length: range.e.c + 1 }, (_, i) => ({
|
||||
/* for an array of arrays, the keys are "0", "1", "2", ... */
|
||||
key: String(i),
|
||||
/* column labels: encode_col translates 0 -> "A", 1 -> "B", 2 -> "C", ... */
|
||||
name: XLSX.utils.encode_col(i)
|
||||
}));
|
||||
```
|
||||
|
||||
![Column labels for headers](pathname:///react/cols.png)
|
||||
|
||||
|
||||
|
||||
[^1]: See [`JSONModel`](https://sdk.openui5.org/1.38.62/docs/api/symbols/sap.ui.model.json.JSONModel.html) in the OpenUI5 documentation.
|
||||
[^2]: See OpenUI5's [MVC Documentation](https://sdk.openui5.org/topic/91f233476f4d1014b6dd926db0e91070) for detailed explanation of the pattern implementation.
|
||||
|
Loading…
Reference in New Issue
Block a user