作者:手浪用户穹谷之鹰 | 来源:互联网 | 2023-09-16 13:05
JSON input does not seem to work. I can get jEXCEL to work with an array:
1
| $('#myTable').jexcel({ data:[['bar1',['bar2']] }) |
, but JSON input gives me empty cells:
1
| $('#myTable').jexcel({ data:[{'foo1':'bar1'},{'foo1':'bar2'}] }) |
.
Same when I try to get my JSON data from an external file.
该提问来源于开源项目:jspreadsheet/jexcel
much appreciated.
On Fri, 4 Oct 2019 at 09:33, mrbladergroen wrote:
any chance you can post this extension -
jExcelExtensions.convertJSONdata()?
Put this code into the 'jexcel\dist\js\jquery.jexcel.extension.js' file:
var jExcelExtensiOns= {
convertJSONdata : function (jsn) {
var jArray = new Array(), i = 0, prop;
for (i = 0; i var v = new Array();
for (prop in jsn[i]) {
if (jsn[i].hasOwnProperty(prop)) {
if (typeof jsn[i][prop] === "string") {
v.push('"' + jsn[i][prop] + '"');
}
else {
v.push(jsn[i][prop]);
}
}
}
jArray.push('[' + v + ']');
}
return '[' + jArray + ']';
},
...
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/paulhodel/jexcel/issues/177?email_source=notifications&email_token=ALE5Z5HHQWLDTMDZZFCENI3QM35VPA5CNFSM4FHSQKV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAK5XIY#issuecomment-538303395,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALE5Z5FREBQ3D4QCVCOAEE3QM35VPANCNFSM4FHSQKVQ
.