PDA

View Full Version : BasicForm.setValues() question



fenuk
15 Nov 2010, 3:25 PM
i run this code:


oForm.getForm().setValues(oGrid.getStore().getAt(nIndex))
after

console.log(oForm.getForm().getFieldValues())say me:



id: 1
name: undefined
surname: undefined
but, json structure my Record this:


id: 1
name: 'name1'
surname: 'surname2'
so, I have problem :-?

I solved this problem that:

oForm.getForm().setValues(oGrid.getStore().getAt(nIndex).json)I want ask: its correct Idea?


and next question:

when i run:

oForm.getForm().loadRecord(oGrid.getStore().getAt(nIndex))

and after

console.log(oForm.getForm().getFieldValues())

i see that form have this values:


id: undefined
name: 'name1'
surname: 'surname1'


so, why we lost id?

please, help

laurentParis
16 Nov 2010, 2:01 AM
lol

I suggest:


var datas = oGrid.getStore().getAt(nIndex);
oForm.getForm().setValues(Ext.apply(datas.json, {id: datas.id}));