﻿// --- Variation of ComboBox where first button is clear, instead of second to clear value of the ComboBox

Ext.form.ClearableComboBox = Ext.extend(Ext.form.ComboBox, {
	qtip: '<a style="font-size: 10pt">V polje Iskanje vpišete text, ki ga iščete.<br/>MESTA, NASELJA, ULICE, PODATKI SLOJEV ...</a>',
	//qtitle: 'Polje za iskanje',
	listeners: {
    render: function(c){
        c.el.set({qtitle:c.qtitle});
        c.el.set({qtip:c.qtip});
        c.trigger.set({qtip:c.qtip});
	}
	},
    initComponent: function() {
        this.triggerConfig = {
            tag:'span', cls:'x-form-twin-triggers', cn:[
            {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger x-form-clear-trigger"},
            {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger x-form-search-trigger"}        
        ]};
        Ext.form.ClearableComboBox.superclass.initComponent.call(this);
    },
    onTrigger1Click : function()
    {
        this.collapse();
        this.reset();                       // clear contents of combobox
        this.fireEvent('cleared');          // send notification that contents have been cleared
    },

    getTrigger: Ext.form.TwinTriggerField.prototype.getTrigger,
    initTrigger: Ext.form.TwinTriggerField.prototype.initTrigger,
    onTrigger2Click: Ext.form.ComboBox.prototype.onTriggerClick,
    trigger1Class: Ext.form.ComboBox.prototype.triggerClass,
    trigger2Class: Ext.form.ComboBox.prototype.triggerClass
});
Ext.reg('clearcombo', Ext.form.ClearableComboBox);

// // --- A ComboBox with a secondary trigger button that clears the contents of the ComboBox
	// Ext.form.ClearableComboBox = Ext.extend(Ext.form.ComboBox, {
    // initComponent: function() {
        // this.triggerConfig = {
            // tag:'span', cls:'x-form-twin-triggers', cn:[
            // {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger"},
            // {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger x-form-clear-trigger"}
        // ]};
        // Ext.form.ClearableComboBox.superclass.initComponent.call(this);
    // },
    // onTrigger2Click : function()
    // {
        // this.collapse();
        // this.reset();                       // clear contents of combobox
        // this.fireEvent('cleared');          // send notification that contents have been cleared
    // },
    
    // getTrigger: Ext.form.TwinTriggerField.prototype.getTrigger,
    // initTrigger: Ext.form.TwinTriggerField.prototype.initTrigger,
    // onTrigger1Click: Ext.form.ComboBox.prototype.onTriggerClick,
    // trigger1Class: Ext.form.ComboBox.prototype.triggerClass
// });