stan229
11 Nov 2011, 9:58 AM
REQUIRED INFORMATION Ext version tested:
Sencha Touch 2.0 rev PR2
Browser versions tested against:
Chrome 15
Safari 5
DOCTYPE tested against:
html5
Description:
When there is an AJAX (rest) store behind a selectfield, it loads the data fine.
However when you select the item from the picker it does not populate the display field and does not set the value.
Steps to reproduce the problem:
Render selectfield in a formpanel.
Select item from select picker
The result that was expected:
Item selected would be displayed in the field
Item selected would be added to the backing form values.
The result that occurs instead:
Item selected not displayed in the field.
form.getValues() shows item value as null
Side Note: The layout seems to be a bit weird also. Note how zip code does not have a bottom border and it looks like the label 'starts over'. Am I not using hbox properly?
Test Case:
Ext.define('SuperQualifier.model.Location', {
extend : 'Ext.data.Model',
fields : [{
name : 'locationName',
type : 'string'
}, {
name : 'id',
type : 'int'
}],
proxy : {
type : 'rest',
url : '../loanQualifier/getLocationTypes',
reader : {
type : 'json',
root : ''
}
}
})
Ext.define('SuperQualifier.store.Locations', {
extend : "Ext.data.Store",
model : 'SuperQualifier.model.Location',
requires : 'SuperQualifier.model.Location',
// data : [{
// locationName : 'Test',
// id : 1
// }, {
// locationName : 'ABc',
// id : 2
// }]
})
Ext.setup({
onReady : function() {
var locationsStore = Ext.create('SuperQualifier.store.Locations');
locationsStore.load()
var popup = Ext.create('Ext.Panel', {
modal : true,
centered : true,
layout : 'fit',
width : 750,
height : 350,
hideOnMaskTap : false,
scrollable : false,
alias : 'widget.addpropertypopup',
items : [{
docked : 'top',
xtype : 'toolbar',
title : 'New Property'
}, {
xtype : 'formpanel',
scrollable : false,
items : [{
xtype : 'fieldset',
instructions : 'Please fill out above information.',
items : [{
xtype : 'textfield',
name : 'address',
label : 'Address',
required : true,
autoCapitalize : true,
}, {
layout : 'hbox',
items : [{
xtype : 'textfield',
name : 'city',
label : 'City',
required : true,
flex : 2,
autoCapitalize : true,
}, {
xtype : 'textfield',
name : 'state',
label : 'State',
flex : 1,
labelWidth : '50%',
required : true
}, {
xtype : 'numberfield',
name : 'zip',
label : 'Zip',
flex : 1,
required : true
}]
}, {
xtype : 'selectfield',
name : 'location',
label : 'Location',
displayField : 'locationName',
valueField : 'id',
store : locationsStore
}]
}, {
layout : 'hbox',
defaults : {
xtype : 'button',
flex : 1,
style : 'margin: .5em'
},
items : [{
ui : 'confirm-round',
text : 'Add',
id : 'addpropertybutton',
handler : function() {
that.submitAddPropertyForm(popup.down('formpanel'))
}
}, {
ui : 'round',
text : 'Cancel',
id : 'canceladdpropertybutton',
handler : function() {
popup.hide()
popup.destroy()
}
}]
}]
}],
});
popup.show()
}
});
HELPFUL INFORMATION
Sencha Touch 2.0 rev PR2
Browser versions tested against:
Chrome 15
Safari 5
DOCTYPE tested against:
html5
Description:
When there is an AJAX (rest) store behind a selectfield, it loads the data fine.
However when you select the item from the picker it does not populate the display field and does not set the value.
Steps to reproduce the problem:
Render selectfield in a formpanel.
Select item from select picker
The result that was expected:
Item selected would be displayed in the field
Item selected would be added to the backing form values.
The result that occurs instead:
Item selected not displayed in the field.
form.getValues() shows item value as null
Side Note: The layout seems to be a bit weird also. Note how zip code does not have a bottom border and it looks like the label 'starts over'. Am I not using hbox properly?
Test Case:
Ext.define('SuperQualifier.model.Location', {
extend : 'Ext.data.Model',
fields : [{
name : 'locationName',
type : 'string'
}, {
name : 'id',
type : 'int'
}],
proxy : {
type : 'rest',
url : '../loanQualifier/getLocationTypes',
reader : {
type : 'json',
root : ''
}
}
})
Ext.define('SuperQualifier.store.Locations', {
extend : "Ext.data.Store",
model : 'SuperQualifier.model.Location',
requires : 'SuperQualifier.model.Location',
// data : [{
// locationName : 'Test',
// id : 1
// }, {
// locationName : 'ABc',
// id : 2
// }]
})
Ext.setup({
onReady : function() {
var locationsStore = Ext.create('SuperQualifier.store.Locations');
locationsStore.load()
var popup = Ext.create('Ext.Panel', {
modal : true,
centered : true,
layout : 'fit',
width : 750,
height : 350,
hideOnMaskTap : false,
scrollable : false,
alias : 'widget.addpropertypopup',
items : [{
docked : 'top',
xtype : 'toolbar',
title : 'New Property'
}, {
xtype : 'formpanel',
scrollable : false,
items : [{
xtype : 'fieldset',
instructions : 'Please fill out above information.',
items : [{
xtype : 'textfield',
name : 'address',
label : 'Address',
required : true,
autoCapitalize : true,
}, {
layout : 'hbox',
items : [{
xtype : 'textfield',
name : 'city',
label : 'City',
required : true,
flex : 2,
autoCapitalize : true,
}, {
xtype : 'textfield',
name : 'state',
label : 'State',
flex : 1,
labelWidth : '50%',
required : true
}, {
xtype : 'numberfield',
name : 'zip',
label : 'Zip',
flex : 1,
required : true
}]
}, {
xtype : 'selectfield',
name : 'location',
label : 'Location',
displayField : 'locationName',
valueField : 'id',
store : locationsStore
}]
}, {
layout : 'hbox',
defaults : {
xtype : 'button',
flex : 1,
style : 'margin: .5em'
},
items : [{
ui : 'confirm-round',
text : 'Add',
id : 'addpropertybutton',
handler : function() {
that.submitAddPropertyForm(popup.down('formpanel'))
}
}, {
ui : 'round',
text : 'Cancel',
id : 'canceladdpropertybutton',
handler : function() {
popup.hide()
popup.destroy()
}
}]
}]
}],
});
popup.show()
}
});
HELPFUL INFORMATION