PDA

View Full Version : Select: use whole model as value?



rflueckiger
22 Aug 2011, 7:02 AM
Hi,

I'm quite new to sencha touch and trying to figure out how to use select form fields with composite models. I have two stores for entities A and B. With A having a field of type B.


Ext.regModel('A', {
fields: [
{ name: "b", type: "B" }
]
}

The final goal is to use a select field to display all entities of B from the (B-)store as choices and set the selected entity on A. I'm currently at a loss how to accomplish this. It sure seems like a pretty basic and common problem, but I can't find the proper way to configure the select field...



items: [{
xtype: 'selectfield',
name: 'b',
store: 'bStore',
displayField: 'name' // a property of B
// valueField: accepts only String/Integer, how do I return the "whole" selected (B-)entity?
}

Thanks for any input/pointers on the proper way to do something like this...