2011-03-30 3 views
0

어떻게 작동하는지 이해하려고합니다. 보기 :SC.SelectView에 대한 도움이 필요합니다.

roleSwitch: SC.SelectView.design({ 
         layout: {top:38, height: 20, width: 256 }, 
         items: [{ title: 'a', isEnabled: YES, checkbox: NO }, 
           { title: 'b', isEnabled: YES, checkbox: NO }], 
           itemTitleKey: 'title', 
           themeName: 'role', 
           showCheckbox: NO 

         }) 

SelectView에 대한 다른 정보를 찾을 수 없습니다. 선택 항목을 미리 선택할 수있는 방법, 선택을 할 때마다 오류가 발생하는 이유는 무엇입니까?

답변

0

선택 : 은이 있다고 가정하자 :

MyApp.roleController = SC.ObjectController({ 
    selectedRoleId: 1; 
}) 

그런 다음보기 :

선택은 'selectedRoleId'의 결합됩니다
roleSwitch: SC.SelectView.design({ 
         layout: {top:38, height: 20, width: 256 }, 
         items: [{ title: 'a', isEnabled: YES, checkbox: NO, roleId: 1 }, 
           { title: 'b', isEnabled: YES, checkbox: NO, roleId: 2 }], 
           itemTitleKey: 'title', 
           themeName: 'role', 
           showCheckbox: NO, 
           itemValueKey: 'roleId', 
           valueBinding: 'MyApp.roleController.selectedRoleId' 

         }) 

roleController