2013-12-23 3 views
1

간단한 양식이 있습니다. 서버 아래 등으로부터 반환 JSON 값 : 당신이 볼 수 있듯이배열에서 양식 텍스트 영역 값 채우기

{ 
"success":true, 
"data":{ 
    "DNR_ID":"9", 
    "DNR_TYPE_ID":"1", 
    "DNR_DEF_ID":"1", 
    "DNR_DESC":"PROCTOR & GAMBLE HAFTASONU AKSIYONU", 
    "STORES": { 
     "0" => "ANKARA" 
     "1" => "ISTANBUL" 
    } 
} 
} 

STORESdata 내부 배열이 있습니다. 그래서, 내가하고 싶은 것은, 그 값을 그 형식으로 사용할 수있는 텍스트 영역에 넣는 것입니다.

ExtJS 간단한 양식 메커니즘이 작동하지 않았습니다.

listeners: { 
    select: function() { 
     if (this.getSelectionModel().hasSelection()) { 
      var row = this.getSelectionModel().getSelection()[0]; 

      Ext.getCmp('dnr-list-info').getForm().load({ 
       url: '<?php echo base_url() ?>/list/get_dnr_info', 
       params: {dnrid: row.get('DNR_ID')}, 
       method: 'GET', 
       success: function(res) { 
        // In fact, this line doesn't necessary because form load function automatically fill the form 
        Ext.getCmp('dnr-list-info').getForm().setValues(res); 
       } 
      }); 
     } 
    } 
} 

답변

1

당신이 텍스트 영역 구성 요소에 downsetValue을 이동해야합니다.

myForm.down('#itemIdForTextArea').setValue('myValue'); 

또는 직접뿐만 아니라 항목 ID로 텍스트 영역을 조회 할 수 있습니다 ...

Ext.ComponentQuery.query('#itemIdForTextArea')[0].setValue('myValue'); 

또는 아이디 .. 또한 경우 sencha docs

+0

에서

Ext.getCmp('idForTextArea').setValue('myValue'); 

추가 정보 있음 레코드의 데이터로 서식을로드하려고합니다. loadRecord를 사용할 수 있습니다. 텍스트 영역의 이름이 상점의 이름과 일치하는지 확인하십시오. – weeksdev