PDA

View Full Version : Some queries in combobox - Ext 1.1 beta 2


manugoel2003
06-29-2007, 05:47 AM
Hi all.... I have been working with comboboxes lately and found some problems with it..... I am also doubtful about certain things.... I would like to put it all up here


[Solved (http://extjs.com/forum/showthread.php?t=3244#post41701)] How can I make the trigger to do a custom action
How can I change the icon of the trigger. I dont want to override the "x-form-arrow-trigger" class as it will affect all the combos. I just want a different icon for the new subclass discussed in the previous point. I tried to set the "triggerClass" config option for it but it doesn't work
Delimiters. I have posted about it earlier as well [Link1 (http://extjs.com/forum/showthread.php?t=7090#post37784)] [Link2 (http://extjs.com/forum/showthread.php?p=41370#post41370)], But I have still not found any descent solution.
The following method selects an item from the list based on its index.
select(Number index, Boolean scrollIntoView)
But the problem is that it works only when the list is expanded. Why?
I simply am not able to bypass validation. I tried setting "validateOnBlur" to false, but it still validates the value on blur. I guess it was working in 1.0.1
Just wondering.... like we have displayField, valueField.... can we have selectionField? The displayField is the text displayed in the list. valueField is the value stored in the corresponding form element to be sent on form submit. And selectionField would be the text displayed in the textbox after a selection is made. This can be different than the diplayField. The scenario sounds stupid but can be useful sometimes. Like if we want to have abbreviated states in the list, full state name in the textbox after selection and a certain code in the value.
[See This (http://extjs.com/forum/showthread.php?t=8473#post44423)] What is doQuery(String query, Boolean forceAll)? Why in the documentation query is mentioned as SQL query?
What is initcomponent()?
[Proposed (http://extjs.com/forum/showthread.php?t=8473#post44196)] Any way of avoiding result caching? Take this scenario..... I have 2 comboboxes A and B.... B's values are dependent on A's value.... both are autosuggestion enabled..... now if I select something in A and type something in B, it displays a list of values and I select one of them.... now I change the value in A and then search for the exact same thing in B again.... this time no AJAX request is made and the result from the last time is showed.... this is not as desired.
So I thought why not reset B on the change event of A. But even after B.reset() it is not cleaning up the result cache.
combobox does not have any getSelectedIndex() method, or any getSelectedText() method.... see the [Link (http://extjs.com/forum/showthread.php?t=8737)]
[Proposed (http://extjs.com/forum/showthread.php?t=8473#post44185)] The change event is not firing



Can anyone shed some light on the aforementioned issues? I'll be updating this thread as and when I find solutions.

Thanx

manugoel2003
06-29-2007, 10:40 PM
sorry for posting it in the wrong forum.... couldn't decide whether it would be entirely a help post or a discussion one.... thanx for moving

manugoel2003
06-30-2007, 06:24 AM
ok another one.... the change event is not firing.... I have attached a handler to the change event and a set a breakpoint there in firebug.... but it never fires

tryanDLS
06-30-2007, 04:02 PM
ok another one.... the change event is not firing.... I have attached a handler to the change event and a set a breakpoint there in firebug.... but it never firesThis question has come up before. The change event is not fired when something is selected, it's fired when the user types a new value in.

manugoel2003
07-03-2007, 07:42 AM
well, what exactly do you mean by
it's fired when the user types a new value in.
will it fire when the user is typing in, or when he is done typing and tries to lose focus? Anyways, it is not working both the ways. I just upgraded to Beta 2 just to be sure and it does not work.

I would like to tell you that I am using it as a autocomplete box with "editable: true".... so he can type in if he wants to or click on the trigger to see the complete list.... either way he will be shown a list from which he will have to *select*, coz I have set "forceSelection: true"..... any ideas?

tryanDLS
07-03-2007, 12:06 PM
change fires when the user types something then leaves the field, but before blur. You can see this in the combo example - Tested in 1.1b2. Alerts 'change', then 'blur' when you type something, then tab off. Alerts 'blur' only if you select.

var combo = new Ext.form.ComboBox({
store: store,
displayField:'state',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
resizable:true, editable:true, forceSelection:true
});
combo.applyTo('local-states');
combo.on('change', function() {alert('change')});
combo.on('blur', function() {alert('blur')});

manugoel2003
07-04-2007, 08:51 AM
I don't know what I am missing, but it is not working for me..... maybe I should re-download the library.... I'll let you know

in the meanwhile, I have still not found a solution to most of the problems listed in the first post.... do u have any clue?

manugoel2003
07-05-2007, 02:45 AM
Found another one.... its more of a feature request, but I think it should have been in the basic feature set..... I have added point 11 in the first post just to keep it all together

combobox does not have any selectedIndex() method, or any getSelectedText() method.... see the [link (http://extjs.com/forum/showthread.php?t=8336)]

cesarulo
07-05-2007, 11:36 PM
Hey Manu,

got an email about your reply to my thread here (http://extjs.com/forum/showthread.php?t=8336), but can't find your post anymore. Anyhoo, thanks for linking back to there and putting all these problems together in one thread. I wasn't sure if I was the only one facing these issues.

I guess I'll try switching to the latest codebase and report here.

Cheers,

manugoel2003
07-06-2007, 02:43 AM
I am sorry about that buddy.... actually I intended to post it in another thread, and accidentally posted it in yours :).... but then I immediately deleted the post citing the reason ...... but I was not very sure if the text I typed in the "Reason for deleting" would show up in your thread (which it did not) or would be emailed to you.... hence the confusion

manugoel2003
07-06-2007, 03:48 AM
Please see the corresponding query in the first post

#12

hmmmm... I have found out that the change event does fire when editing the field directly instead of selecting the value, however, it does not fire if I erase the contents of the field completely...... moreover, the behavior in this case is very strange..... see the following snapshots
863
864
865
as soon as u loose focus of the field after erasing the text, the text appears again, although dimmed.... getValue() returns the value of the last item selected before erasing it, getRawValue() returns blank string.... One thing should be kept in mind, I am using "forceSelection: true"..... it works fine without this setting

I did a small override, and it worked for me..... here you go
Ext.override(Ext.form.Field, {
onBlur : function(){
this.beforeBlur();
this.el.removeClass(this.focusClass);
this.hasFocus = false;
if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){
this.validate();
}
//var v = this.getValue();
var v = (this.getRawValue() == "") ? "" : this.getValue(); <--------- Added this line
if(v != this.startValue){
this.fireEvent('change', this, v, this.startValue);
}
this.fireEvent("blur", this);
}
});

manugoel2003
07-06-2007, 04:26 AM
Please see the corresponding query in the first post

#9

I have devised an override for this problem which includes adding of a custom property "disableResultCache", which you can pass in the config and have the result cache disabled..... u just have to include "disableResultCache: true" in the config for this to work..... I also had to override the "doQuery" method.... here is my solution

Ext.override(Ext.form.ComboBox, {
disableResultCache : false,
doQuery : function(q, forceAll){
if(q === undefined || q === null){
q = '';
}
var qe = {
query: q,
forceAll: forceAll,
combo: this,
cancel:false
};
if(this.fireEvent('beforequery', qe)===false || qe.cancel){
return false;
}
q = qe.query;
forceAll = qe.forceAll;
if(forceAll === true || (q.length >= this.minChars)){
if(!this.disableResultCache && this.lastQuery == q){
this.selectedIndex = -1;
this.onLoad();
}else{
this.lastQuery = q;
if(this.mode == 'local'){
this.selectedIndex = -1;
if(forceAll){
this.store.clearFilter();
}else{
this.store.filter(this.displayField, q);
}
this.onLoad();
}else{
this.store.baseParams[this.queryParam] = q;
this.store.load({
params: this.getParams(q)
});
this.expand();
}
}
}
}
});

manugoel2003
07-07-2007, 01:55 AM
has anyone tested the above 2 methods..... if someone finds any problem then please let me know

manugoel2003
07-07-2007, 02:02 AM
Please see the corresponding query in the first post

#7

I have understood the purpose of doQuery() as well.... it is just a method to manual invoke an AJAX call for the autosuggestion..... I have overrided this method in the solution to #9..... if you see the code, you will understand that it just makes an explicit AJAX request with the passed in text as query for the autosuggestion...... however the documentation should be updated

manugoel2003
07-10-2007, 08:52 AM
hello everyone..... just bumping in to check if someone found any solution to the problems, and to keep this thread alive..... I will upgrade to RC1 and see if the problems are still there

cesarulo
07-16-2007, 10:59 AM
Hi Forum,

are Manu and I the only ones running into problems with Comboboxes. Doesn't *anybody* have any answers to the questions he poses?

I've upgraded to the latest RC release, and these Comboboxes are NOT working for me. It's so bad, that I'm even thikning about canning them and replacing them with plain old textboxes.

Can we get some attention here please?

tryanDLS
07-16-2007, 11:33 AM
Frankly, this thread has gotten so long and covers so many questions, that nobody knows what's going on. There have been a ton of threads regarding combos and that makes me think people would answer if they didn't have to try and read this entire thread and figure out what was not working, what you solved, and which example goes with which problem.

I would suggest that you
1) upgrade to 1.1RC1 and test these things.
2) Create new posts for issues that you still see - one post for each issue, so we don't repeat the problem of this thread.

Thanks,

cesarulo
07-16-2007, 11:52 AM
Hi tyranDLS,

my apologies about getting a bit impatient. I am currently running to hell and back with one particular problem. If I can't solve it I guess I'll post a separate thread and send a message to Manu to update this thread. I still think it's a good idea to keep a 'list of problems' with ComboBoxes.

manugoel2003
07-16-2007, 01:08 PM
I also feel that keeping things together in one thread is a lot more convenient than sifting through a dozen different threads......... this was the main intention......... but I do agree that one can loose track of what is being discussed if there are too many topics to be discussed......... I tried to put links wherever necessary, but all the links get converted into external links......... I think there should be an option of allowing in-page links, so that it would be more convenient to cross-reference posts in the same thread.........

but I think I will continue with this thread for now......... and as and when I find concrete solutions to the problems listed here, I will post new threads specific to them......... or update a thread which is already discussing that issue and link to it here.........

In the meantime, if anyone could verify whether the solutions provided by me work for them or not then it would be very nice, and then I can move them out of this thread......... they work for me

cesarulo
07-16-2007, 01:14 PM
Hi Manu,

I'm with you on this one. Basically I feel that Comboboxes are so problematic, they deserve a thread of their own. We can start separate threads to deal with individual problems and then come back here and link to them. I will report the results of any findings in this thread.

efege
08-29-2007, 01:57 PM
Basically I feel that Comboboxes are so problematic, they deserve a thread of their own. We can start separate threads to deal with individual problems and then come back here and link to them. I will report the results of any findings in this thread.

Hi,

I've been away from the forums for a while, and in particular I'm not sure if there's been some progress around the issues discussed in this thread, but regarding the problem of single vs. multiple threads, please let me suggest something: use the wiki to keep an up-to-date overview of all the issues related to combo boxes (or any other Ext component, for that matter), and use forum threads only to discuss specific problems. Don't you think it's a good balance? :)

cesarulo
08-30-2007, 01:40 PM
Hi everybody,

I have updated to RC1 and re-factored my code extensively, and the ComboBoxes are now working like a charm for me... that's why I haven't paid much more attention to this thread.

Are people still complaining about Comboboxes? If so, perhaps I can help...

mystix
08-30-2007, 01:57 PM
RC1? woah... prehistoric :D (1.1.1's out today btw ;))

what problems exactly were solved when you updated to RC1?
is there anything still lacking after the update?

cesarulo
08-30-2007, 02:06 PM
Hey,

well, I was having a number of problems, some perhaps related to bugs in the library, some definitely related to my lack of understanding of the API (a whole host of problems disapperaed when I learned to use the queryAction:'all' config option for example).

After upgrading, I completely refactored the application, shrinking the code to a 20% of its original size. Many, many problems disappeared, only a fraction of which were related to the combos. And once the application worked, quite frankly I didn't feel like writing a list of problems, let alone tracking each individual one and figuring out why it had disappeared. The application worked, I paid the rent, and forgot about the problems...

So I can't really answer your question - I'm sorry - I just don't remember! :(

Wish I could be more helpful. Cheers,

mystix
08-30-2007, 02:09 PM
sounds good. :)

maybe you could help other readers out by putting down in words what you learnt about the queryAction config?

houh
08-13-2008, 02:32 PM
Hi

Iam looking for a working example of two dependent EXTJS combo boxes whose one's data depends on the other.
Can you please post your working example. That would be much much appreciated.

Cheers

Houh