选择xtype监听器无法访问多字段和多字段无法触发dialog.form.findfield

时间:2014-01-05 09:23:40

标签: extjs4 cq5 aem day-cq

我一直致力于禁用内容并忽略在选择字段中填充的数据,该选择字段构成CQ5对话框附带的多字段的一部分

下面是无效的代码

    <medicineType
         jcr:primaryType="cq:Widget"
        fieldLabel="medicine Type : "
        name="./medicinetype"
        blankText="medicine Type"
        type="radio"
        xtype="selection">
        <options jcr:primaryType="cq:WidgetCollection">
          <inactive
            jcr:primaryType="nt:unstructured"
            text="medicine Lead"
            value="medicinelead" />
          <active
            jcr:primaryType="nt:unstructured"
            text="doctor Lead"
            value="doctorlead" />
        </options>
              <listeners jcr:primaryType="nt:unstructured" 
        selectionchanged="function(box,value){
        if(value == 'medicinelead'){
            var ans =     box.findParentByType('dialog').form.findField('./medicinedoctorset'); 
            ans.setDisabled(true);  
        ans.getEl().up('.x-form-item').setDisplayed(false);
            }
            "/>
    </medicineType>

    <medicinedoctorset
        fieldLabel="doctor cards"
        jcr:primaryType="cq:Widget"
        name="./medicinedoctorset"
        xtype="multifield">
        <fieldConfig
          jcr:primaryType="cq:Widget"
          type="select"
          options="/apps/doctor-api/components/medicineview/doctorcards.json"
          optionsRoot="doctorcards"
          optionsTextField="label"
          optionsValueField="id"
          xtype="selection" />
      </medicinedoctorset>

1 个答案:

答案 0 :(得分:0)

不确定您在代码中究竟要做什么,但在我看来,您正试图禁用某个特定领域的药物治疗师。尝试将id添加到要禁用的字段,获取和禁用该字段为CQ.Ext.getCmp(“idOfTheFieldToBeDisabled”)。setDisabled(true);希望这会有所帮助。