2011-03-30 14 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; 
}) 

次に、あなたのビューで: はあなたがこれを持っているとしましょう

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

の 'selectedRoleId' にバインドされます
関連する問題