本帖最后由 Richard.Huang 于 2023-10-31 12:26 编辑
产品:SpreadJS
版本:V14.0.6
比如这种形式的绑定数据:
- var datasource = [
- {
- name: "Alice",
- age: 27,
- birthday: "1985/08/31",
- position: "PM",
- address: { postcode: "710075" },
- },
- ]; // bindColumn one by one
- var nameColInfo = { name: "name", displayName: "Display Name", size: 70 };
- var ageColInfo = {
- name: "age",
- displayName: "Age",
- size: 40,
- resizable: false,
- };
- var birthdayColInfo = {
- name: "birthday",
- displayName: "Birthday",
- formatter: "d/M/yy",
- size: 120,
- };
- var positionColInfo = {
- name: "position",
- displayName: "Position",
- size: 50,
- visible: false,
- };
- sheet.autoGenerateColumns = false;
- sheet.setDataSource(datasource);
- sheet.bindColumn(0, nameColInfo);
- sheet.bindColumn(1, birthdayColInfo);
- sheet.bindColumn(2, ageColInfo);
- sheet.bindColumn(3, positionColInfo);
复制代码 怎么加一列address,取的是数据源里的address.postcode呢?
|