PDA

View Full Version : [CLOSED][3.0rc1.1] ComboBox/JsonStore bug



mikedoug
11 May 2009, 7:41 PM
You can refer to my thread in the help section (http://www.extjs.com/forum/showthread.php?t=68083) -- but I will do a better job of laying out the problem in THIS thread.

This may or may not be fixed in the SVN tree, but since I don't have access to that I can neither confirm nor deny, and thus I am submitting this as a bug report.

Version: Ext JS Library 3.0 RC 1.1

Executive Overview:

I created a ComboBox with mode: remote and a JsonStore store.

When clicking the trigger the dropdown appears with the spinner and the "Loading..." text.

Using Firebug I can confirm that the remote data script was properly called, and returned the below quoted data.

Tracing through the Ext JS code I've found that the Ext.data.Store.loadRecords() call to this.fireEvent("datachanged", this) fails to call the registered 'datachanged' function Ext.DataView.refresh(). (This is registered in Ext.DataView.bindStore())

Inside the EXTUTIL.Observable.prototype.fireEvent call for 'datachanged' the 'ce' parameter is set to the boolean value of 'true' and NOT an object -- causing the ce.fire.apply(ce,a) call to be skipped.


The creation of my ComboBox:
I have two methods by which I've tried to create the ComboBox -- both exhibited the SAME behavior.

Method ONE:


{
fieldLabel: 'Testing Combo',
name: 'testing_combo',
xtype: 'combo',
mode: 'remote',
autoLoad: true,
typeAhead: true,
store:
{
xtype: 'jsonstore',
url: '/dev2/api/get-contacts.pl',
root: 'contacts',
fields: [
'id',
'name'
],
},

listWidth: '300',
hiddenName: 'testing_combo_name',
triggerAction: 'all',
valueField: 'id',
displayField: 'name'
}


Method TWO:


{
fieldLabel: 'Testing Combo',
name: 'testing_combo',
xtype: 'combo',
mode: 'remote',
autoLoad: true,
typeAhead: true,
store:
{
xtype: 'store',
url: '/dev2/api/get-contacts.pl',
reader: new Ext.data.JsonReader({
root: 'contacts',
fields: [
'id',
'name'
],
})
},

listWidth: '300',
hiddenName: 'testing_combo_name',
triggerAction: 'all',
valueField: 'id',
displayField: 'name'
}


Here is the data returned by /dev2/api/get-contacts.pl:



{
"contacts": [{
"name":"John Doe",
"id":"332"
}]
}


I posted this in the HELP forum first while I ran through the Ext code to figure it out, but I'm more comfortable with the fact that this is a bug now.

Thanks,
MikeDoug

evant
11 May 2009, 8:13 PM
Just to clarify, the bug is your data isn't being loaded? If so I can't replicate it, I'm using the following:



Ext.onReady(function(){
var fp = new Ext.form.FormPanel({
width: 400,
height: 400,
renderTo: document.body,
items: {
fieldLabel: 'Testing Combo',
name: 'testing_combo',
xtype: 'combo',
mode: 'remote',
autoLoad: true,
typeAhead: true,
store: {
xtype: 'jsonstore',
url: 'data.asp',
root: 'contacts',
fields: ['id', 'name']
},
listWidth: '300',
hiddenName: 'testing_combo_name',
triggerAction: 'all',
valueField: 'id',
displayField: 'name'
}
});
});


My data.asp page returns


{
"contacts": [{
"name":"John Doe",
"id":"332"
}]
}


I'd suggest you add a loadexception listener to your store to make sure it's all working properly.

mikedoug
11 May 2009, 8:20 PM
Correct -- the data never loads -- it just sits there with the spinner with "Loading..."

I have done both a load and loadexception handlers -- and the load fires with a count of 1 record returned.

Are you doing your testing with the released version of 3.0rc1.1?

You can experience it here:

--URL removed--

evant
11 May 2009, 8:23 PM
I'm using the latest SVN build. However I'm reasonably sure xtype support for stores in combos was added post RC1.1. Try your code using a pre-declared store instead of using an xtype.

mikedoug
11 May 2009, 8:39 PM
I've tried both ways. It creates the store object -- read my original post, it tells you EXACTLY where it breaks down with the firing of the event.

That said -- if you say it works with the new SVN code base, then that's great I'll just wait for the next rc release. Do you know when that would be? It could save on bug reports for fixed items. :)

Thanks,
MikeDoug

evant
11 May 2009, 9:36 PM
Once again, just to clarify, you've tried it with:



var store = new Ext.data.JsonStore();
var cmb = new Ext.form.ComboBox({
store: store
});


There was a bug in the combo that if you provided an xtype store it would end up creating 2 store objects, so the dataview would have a seperate store to the combo.

mikedoug
11 May 2009, 10:05 PM
Well, now that you put it that way -- apparently I hadn't tried that specific permutation. That fixed my problem. I'll comment my code to try the xtype method when you release the next RC or the final 3.0 :)

Thanks for your assistance!

MikeDoug