if you had a static store, you could just use:
filterPickList: true,
that removes the already selected entries from the combo, but with dynamic data, you have to check if the values are already picked:
listeners:{
beforeselect:function ( combo, record, index, eOpts ) {
if (combo.getValue().indexOf(record.data['ID'])!=-1) return false;
}
}
EDIT:
Try this solution with template to mark the list as selected when the combo reloads:
listConfig: {
itemTpl: new Ext.XTemplate(
'<tpl for=".">',
' <div ',
' <tpl if="this.isSelected(ID)"> ',
' class="x-boundlist-selected" ' ,
' </tpl>',
' ><span>{NAME}</span></div>' ,
'</tpl>',
{
isSelected: function(id){
return (this.owner.up("tagfield").getValue().indexOf(id)!=-1);
},
})
},
Remember to remove the "filterPickList"
here is a working sample FIDDLE
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…