简体   繁体   English

将JSON数据数组导入传播JS

[英]Import Array of JSON Data into spread JS

I am trying to import an array of object into spreadjs, I am using the fromJSON method but it doesnt get imported, my data is an array of object that looks like this我正在尝试将 object 数组导入到 spreadjs 中,我正在使用fromJSON方法但它没有被导入,我的数据是一个 object 数组,看起来像这样

let jsonObj = 
 [{ 'name' : 'One',
   'id': 1,
   'colour': 'blue'
 },
 { 'name' : 'Two',
   'id': 2,
   'colour': 'yellow'
 },
 { 'name' : 'Three',
   'id': 3,
   'colour': 'red'
 }]

I am currently doing sheet.fromJSON(jsonObj)我目前正在做sheet.fromJSON(jsonObj)

Thank for using GrapeCity SpreadJS - fromJSON method is used to load a complete spreadsheet file based on our SSJSON file format.感谢使用 GrapeCity SpreadJS - fromJSON 方法用于加载基于我们的 SSJSON 文件格式的完整电子表格文件。 However, to load an array you can use setBindingPath and setDataSource methods to bind cells to your object properties and then bind the array.但是,要加载数组,您可以使用setBindingPathsetDataSource方法将单元格绑定到 object 属性,然后绑定数组。

here is an example这是一个例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM