ExtJS 6将TPL用作现代的边缘选择器

时间:2019-02-26 14:14:58

标签: extjs extjs6 extjs6-modern

我已经尝试了几天,用这样的XTemplate填充selectfield的边缘选择器选择器:<div>BONJOUR <br> {sNotificationTypeTitle}</div>

在代码数据库(picker.js,slot.js ...)中进行了许多搜索之后,我发现如何通过替换如下所示的createEdgePicker函数来在选择器插槽中应用TPL:

createEdgePicker: function() {
    var me = this;

    var pickerSlot = {
        align: me.getPickerSlotAlign(),
        name: me.getValueField(),
        valueField: me.getValueField(),
        value: me.getValue(),
        store: me._pickerStore || me.getStore()
    }

    if (Ext.isEmpty(me.pickerTpl)) {
        pickerSlot.displayField = me.getDisplayField();
    }
    else {
        /**
         * ext/modern/modern/src/picker/Slot.js ligne 97
         * @cfg {String} itemTpl The template to be used in this slot.
         * If you set this, {@link #displayField} will be ignored.
         */
        pickerSlot.itemTpl = me.pickerTpl;
    }

    return Ext.merge({
        ownerCmp: me,
        slots: [pickerSlot],
        listeners: {
            change: me.onPickerChange,
            scope: me
        },
        setStore: function(store) {
            this.child('pickerslot').setStore(store);
        },
        deselectAll: function() {
            this.child('pickerslot').deselectAll();
        }
    }, me.getEdgePicker());
},

但是它只在一行上适用于TPL,当我尝试使用最终的TPL时,它与
不起作用:

使用<div>BONJOUR {sNotificationTypeTitle}</div>

enter image description here

使用<div>BONJOUR <br> {sNotificationTypeTitle}</div>

enter image description here

提琴:https://fiddle.sencha.com/#view/editor&fiddle/2q4j

因此,如果您中的任何一个使用相同或其他解决方案解决了此问题,请分享;)

我正在使用带有现代工具包的ExtJS 6.6。

0 个答案:

没有答案