PDA

View Full Version : [CLOSED] Combobox click arrow down not fire



infonext
Oct 10, 2013, 9:15 AM
Hi all,

i need to intercept click on arrow down button of combobox.
I tried IconClick, IndicatorIconClick and TriggerClick directevents without success.
The only event which fire when i click is BeforeQuery, but it's fire also when i finish to type something in combobox and in my case is not acceptable because i need to open a search window.

Any suggestions?

Thanks.

Daniil
Oct 10, 2013, 1:47 PM
Hi @infonext,

There is no event in API to be fired on a trigger click.

Maybe, the Expand event can meed your requirement.

infonext
Oct 11, 2013, 8:08 AM
Hi Daniil,

thanks for your answer, but my combo is initially empty, then expand method not fire.
Probably a workaround is to add an empty string object. It's right?

Daniil
Oct 11, 2013, 10:05 AM
Could you, please, describe the requirement in details? Maybe, there is a better solution.

infonext
Oct 14, 2013, 10:07 PM
Hi Danil,

my target is to open a window on combobox click or if the user leave the field with "TAB" button.
Initially the combobox and related store is empty.
If a user enter a value in combobox and press "TAB" or click drop down icon, a window is opened with a page for search an item and the text value of the combobox is passed to the new window like a filter.

see image1 and image2.
70437044

Then the user start the search and if get a value with double-click on value closes the window and combobox is filled with this value (i add this element to the store)

With expand event i need to add an empty value to combobox before, but the expand is not a good choice because i can get this event wrongly, for example if i press down key or if i type any key after i have filled the combobox with select value.
I also tried with beforequery, but is not good because the window opens when a i finish to type something in combobox.

I also tried with TriggerField and work well, but i need to visualize a value in the field and use another value (like DisplayField and ValueField of combobox).
So i tried to set Tag value of TriggerField with this instruction on double-click of opened window


parent.Ext.getCmp(getParameterByName('caller')).se tTag(rec.COMU_ID)

but if i try to get this value on a DirectEvent, this value is null.

Can you help me?

Thanks

Baidaly
Oct 15, 2013, 12:23 AM
Hello!

I think in your case it will be easier to use TriggerField in combination with Hidden field to save value and send it to the server.

infonext
Oct 16, 2013, 8:29 AM
Hi Baidaly,

thanks for your answer.
But I need some controls like this on my page.
So I thought to add an Hidden field to properties of combobox (currently i use an extended version of combobox) for my needs.
You think that there could be problems?


Thanks

Daniil
Oct 16, 2013, 11:15 AM
To catch a click on a ComboBox's trigger, you could override the onTriggerClick method. Here is the original version.

Ext.form.field.ComboBox.override({
onTriggerClick: function() {
var me = this;
if (!me.readOnly && !me.disabled) {
if (me.isExpanded) {
me.collapse();
} else {
me.onFocus({});
if (me.triggerAction === 'all') {
me.doQuery(me.allQuery, true);
} else if (me.triggerAction === 'last') {
me.doQuery(me.lastQuery, true);
} else {
me.doQuery(me.getRawValue(), false, true);
}
}
me.inputEl.focus();
}
}
});

Though, I agree with @Baidaly, it looks that a TriggerField is better for your requirement.

infonext
Oct 17, 2013, 8:40 PM
Hi Daniil,

thanks for your sample.
But is possible to override server side OnTriggerClicked function?
I tried, but not work, if i set a breakpoint does not intercept.

Thanks.

Baidaly
Oct 17, 2013, 9:01 PM
Hi Daniil,

thanks for your sample.
But is possible to override server side OnTriggerClicked function?
I tried, but not work, if i set a breakpoint does not intercept.

Thanks.

I'm not sure what you mean, I don't see any method OnTriggerClicked within TriggerField class. Moreover, usually all method of any Control return some JS code, so you need to execute some JS code anyway, which is usually better to do on ClientSide.

Can you clarify?

infonext
Oct 18, 2013, 8:38 AM
Hi Baidaly,

sorry there was a misunderstanding.
I'm talking about OnTriggerClicked of combobx as a response to Daniil.

Daniil
Oct 18, 2013, 12:48 PM
There is no server side counterpart of the onTriggerClick method.

You could call a DirectMethod from the onTriggerClick method.

infonext
Oct 28, 2013, 9:30 AM
Thanks to all,

i solved with the advice of Baidaly.

You can close the thread.