0
我在我的JavaScript代碼中有以下部分,其中我想使用包含信息的變量來填充數據源而不是寫下信息。
有沒有辦法可以做到這一點?Syncfusion調度程序數據源
...
resources: [
{
field: "IdDepartament",
title: "Departament",
name: "Departaments", allowMultiple: false,
resourceSettings: {
dataSource: [
//{ text: "Sales", id: 1, groupId: 1, color: "#100000" }, { text: "Programming", id: 2, groupId: 1, color: "#199999" }, { text: "Human Resources", id: 3, groupId: 1, color: "#299998" }, { text: "Support", id: 4, groupId: 1, color: "#399997" }
],
text: "text", id: "id", groupId: "groupId", color: "color"
}
},
...
我生成信息,以通過使用Ajax和它保存爲一個JavaScript變量,並顯示在執行console.log的信息,只是爲了確保我收到了正確的信息在數據源中。
編輯:
我想要做這樣的事情:
var departments = ({ text: "Sales", id: 1, groupId: 1, color: "#100000" }, { text: "Programming", id: 2, groupId: 1, color: "#199999" }, { text: "Human Resources", id: 3, groupId: 1, color: "#299998" }, { text: "Support", id: 4, groupId: 1, color: "#399997" });
,並使用該變量在哪裏指定數據源