PDA

View Full Version : Ext JS 3.3.1 displayField shows valueField



Tof32
14 Feb 2017, 4:09 AM
Hello,

i am using a ComboBox like



var storedata = new Ext.data.Store({
url: 'xxxx.php',
reader: new Ext.data.JsonReader({root: 'items', totalProperty: 'totalCount'}, [
{name: 'name'},
{name: 'id'}
]),
baseParams: {"action": "getDATA", "dataid": dataid}
});
store: storedata, valueField: 'id',
displayField: 'name',
typeAhead: true,
hiddenName: 'FILD',
allowBlank: false,
fieldLabel: 'FILD',
mode: 'local',
forceSelection: true,
triggerAction: 'all',
emptyText: 'FILD',
selectOnFocus: true,
anchor: '95%'

i have a form which shows data. The problem ist after creating a new data and submiting everything the fields show sometimes the ID value and sometimes the displayfield "name". it ONLY happens after creating a new one and after that change the data (like create->than update-> than the Field shows either ID or name). if i reload the page the data always shows the displayfield. so after creating a new data and updating that one the displayfield changes sometimes to ID from name. it is only a display problem. i don't know its kind a random. it happens on every browser.

I am sry my english isnt very good i hope i could explain my problem.

Gary Schlosberg
14 Feb 2017, 8:18 AM
I'm not sure you have the reader config quite right, especially the data. Have you looked at the doc page example?
http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.data.JsonReader

Tof32
15 Feb 2017, 2:39 AM
I'm not sure you have the reader config quite right, especially the data. Have you looked at the doc page example?
http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.data.JsonReader

Well, It's an old code i didn't write it. It's working that's not the problem. it calls a PHP Function which than gets the ID and the Name. That works correct but after creating a new dataset and updating that the field shows sometimes the ID and sometimes the name (as in the Frontend) but the data is saved correct and if i reload the page it always shows the name again.
I guess it's impossible to find a solution with only that description :( well i will read your LINK and some more to try to fix it.

Tof32
15 Feb 2017, 3:33 AM
sry double post because i didnt see that someone has to read it first i resend it.