2016-08-22 3 views
0

정보를 기록하는 대신 데이터 소스를 채울 정보가 포함 된 변수를 사용하려는 자바 스크립트 코드에 다음 부분이 있습니다.
할 수있는 방법이 있습니까?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" 
        } 
       }, 
... 

난 그냥 내가 올바른 정보를받을 확인하기 위해, 아약스를 사용하여 자바 스크립트 변수로 저장하고 CONSOLE.LOG에 대한 정보를 표시하여은 dataSource에 표시되는 정보를 생성합니다.

편집 : 이런 식으로 뭔가하고 싶은
: 나는 데이터 소스를 지정하는 변수를

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" }); 

를 사용

답변

0

예, 포함하는 변수를 할당 할 수 있습니다 아래와 같이 직접 정보를 쓰지 않고 dataSource를 채우는 정보

// variable with resource data information 
var resourceData = [ 
        { text: "Nancy", id: 1, groupId: 1, color: "#f8a398" }, 
        { text: "Steven", id: 3, groupId: 2, color: "#56ca85" }, 
        { text: "Michael", id: 5, groupId: 1, color: "#51a0ed" } 
] 

resources: [ 
        { 
         field: "ownerId", 
         title: "Owner", 
         name: "Owners", allowMultiple: true, 
         resourceSettings: { 
          dataSource: resourceData, // assigning the variable to resource data source 
          text: "text", id: "id", groupId: "groupId", color: "color" 
         } 
        }] 
관련 문제