2016-08-29 5 views

답변

2

몰라 부착 된 바이올린,하지만 쉽게 찾을 수 있어야합니다 당신은 생성 된 마크 업에 보면

  • , 선택한 항목이 클래스가 찾을 x-tagfield-item-selected .
  • ExtJS 코드베이스를 tagfield-item-selected으로 검색하면 tagSelectedClsExt.baseCSSPrefix + 'tagfield-item-selected' 인 것을 찾으십시오.

    me.multiSelectItemTpl = new Ext.XTemplate([ 
         '<tpl for=".">', 
          '<li data-selectionIndex="{[xindex - 1]}" data-recordId="{internalId}" class="' + me.tagItemCls + childElCls, 
          '<tpl if="this.isSelected(values)">', 
          ' ' + me.tagSelectedCls, 
          '</tpl>', 
    

    기능에 isSelected 있습니다 :

    isSelected: function(rec) { 
        return me.selectionModel.isSelected(rec); 
    }, 
    
  • 기회가 참조 selectionModel의 높은

  • 당신은이 xtemplate에 사용되는 것을 발견, tagSelectedCls의의 ExtJS 코드베이스를 검색하는 경우 me.selectionModel은 ExtJS의 표준 선택 모델이므로 selectionchange 이벤트를 가질 수 있습니다. 시도해 보겠습니다.

    var tagfield = Ext.create('Ext.form.field.Tag', { 
    ... 
    }); 
    tagfield.selectionModel.on('selectionchange',function() {console.log('selectionchange')}); 
    

    작동.

+0

감사합니다. 정말 대단합니다! :) – AngryLeo

+0

후속 질문이 있습니다. 선택한 각 항목에 툴팁을 표시하고 싶습니다. 어떻게 처리합니까? – AngryLeo