问题: 我不明白为什么找不到'contentType'参数。我拼写正确。我假设我没有正确设置参数。支持链接中的信息没有帮助。我的猜测是我没有正确引用该对象。
有什么想法吗?
错误: DataTables警告:表id =附件-请求的未知参数'contentType'为第0行第0列。有关此错误的更多信息,请参见http://datatables.net/tn/4
JSON :
sess = tf.Session(graph=tf.get_default_graph())
tf.keras.backend.set_session(sess)
with sess.as_default():
model = create_model()
model.summary()
model.fit(x_train_shaped[:10000], y_train[:10000], epochs=2,
batch_size=64, validation_split=.2,)
model.layers[0].output
print(model.layers[0].output.shape)
my_array = model.layers[0].output
my_array.eval()
tf.keras.backend.clear_session()
sess.close()
JAVASCRIPT :
[{
"_data$p$0": {
"id": "AAMkADU4MzkxN2RmLTdiZS53ao=",
"name": "somefile.xlsx",
"contentType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"size": 43069,
"attachmentType": 0,
"isInline": false
}}]
HTML :
Office.initialize = function (reason) {
$(document).ready(function () {
app.initialize();
window.alert = function (message) { app.showNotification("DataTable", message); };
var attachments = localStorage.getItem("Attachments");
console.log(attachments);
// Display Table
$('#attachment').DataTable({
data: attachments,
columns: [
{ data: 'contentType' },
{ data: 'name' }
]
});
});};
答案 0 :(得分:1)
我需要做两件事。个别而言,两者都不起作用。
这是工作代码
Office.initialize = function (reason) {
$(document).ready(function () {
app.initialize();
window.alert = function (message) { app.showNotification("DataTable", message); };
// The value in localStorage was set with JSON.Stringify
// Now I make it a JSON object once again
var attachments = JSON.parse(localStorage.getItem("Attachments"));
// Display Table
$('#attachment').DataTable({
data: attachments,
columns: [
{ data: '_data$p$0.contentType' }, //Dot notation to reference the elements
{ data: '_data$p$0.name' }
]
});
});
};