2012-06-25 8 views
0

내가 ExtJS로 3.3을 사용하고 내가 내은 FormPanel에 대한 다음과 같은 코드가 있습니다메이크업 '텍스트 필드는'읽기 전용 사용 조건 내선 JS 3.3

...... Ext.apply (이, { 항목 : {위해 xtype '텍스트 필드가'fieldLabel가 '오른쪽'이름 :, labelAlign 'ApplicationGUID'Application_GUID '값 : 0 읽기 전용 : FALSE, 폭 : 300} {위해 xtype'텍스트 필드 'fieldLabel' ApplicationName을 'labelAlign :' '이름 :'바로 응용 _ 프로그램 ', 앵커 :'-20 ', msgTarget :'측면 '}

 ], //eof items 
     tbar: [ 
      { xtype: 'mydeletebutton', scope: this, ownerCt: this, handler: this.deleteHandler, 
       myAuth: { compBaseRights: { Delete: { failProperty: { disabled: false}}/*eof Delete*/}/*eof compBaseRights*/}/*eof sgAuth*/ 
      }, 
      { xtype: 'tbseparator' }, 
      { xtype: 'trashcanbutton', scope: this, ownerCt: this, handler: this.setIsDeletedHandler, 
       myAuth: { compBaseRights: { Insert: { failProperty: { disabled: false}} /*eof Delete*/}/*eof compBaseRights*/} 
      }, 
      { xtype: 'mytrashcanrestorebutton', scope: this, ownerCt: this, handler: this.unsetIsDeletedHandler, 
       myAuth: { compBaseRights: { Insert: { failProperty: { disabled: false}} /*eof Delete*/}/*eof compBaseRights*/} 
      }, 
      { xtype: 'tbseparator' }, 
      { xtype: 'mysavebutton', scope: this, handler: this.saveHandler, 
       myAuth: { compBaseRights: { Write: { failProperty: { disabled: false}} /*eof Delete*/}/*eof compBaseRights*/} 
      } 
     ], 
     bbar: { xtype: 'mystatusbar' } 

. ...

내가 찾고있는 것은 'textfield'Application_GUID입니다. 읽기 전용 일 필요가 있습니다 : 값이 이미 있으면 true입니다 (예 : 편집 할 그리드에서 기존 텍스트를 두 번 클릭 할 때처럼).), 그리드에서 새 버튼을 누르면 readonly 문이 거짓이어야합니다. 누군가가 나를 도울 수 있다면

, 그것은 창살 것입니다. 감사.

답변

1

좋은 방법은 초기화하는 거짓 부울 변수를 설정하는 것이다. 그런 다음 필요에 따라 참으로 설정하십시오.

그런 다음 변경 청취자에 예를 들어, 다음 예제 코드처럼 필요한 리스너를 추가 : 그것은 일

listeners: { 
    yourlistener: function(e) { //yourlistener can be change, select, etc... 
     if (booleanVariable === true) Ext.getCmp('your-textbox-id').setReadOnly(true); 
     else Ext.getCmp('your-textbox-id').setReadOnly(false); 
    } 
} 
+0

. 고마워, 크리스 – crisbro

관련 문제