PDA

View Full Version : Using JsonStore into TextField



fillippcabral
17 Nov 2009, 6:20 PM
Hi guys...
I have a little problem...first, Im sorry about my english...Im braziliam...
so, I just want to know how I can get the value from a JsonStore with a specific field in the Json string...

Example:

I have the JsonStore...




var storeValue = new Ext.data.JsonStore({
url: 'system/Value.php',
root: 'rows',
fields: ['field1', 'field2', 'field3', 'field4']
});



and I want to get the value from 'field1' in storeValue and bring to a TextField...like hm...



{
xtype: 'textfield',
fieldLabel: 'Text_Field1',
name: 'txtField1',
id: 'txtField1',
width: 230
}


thx to everyone! ;D

dlbjr
17 Nov 2009, 6:59 PM
var storeValue = new Ext.data.JsonStore({
url: 'system/Value.php',
root: 'rows',
fields: ['field1', 'field2', 'field3', 'field4']
});

var tf = new Ext.form.TextField({
id: 'txtField1',
name: 'txtField1',
fieldLabel: 'Text_Field1',
width: 230
});

ds.on('load', function() {
if (this.getCount() > 0) {
tf.setValue(this.getAt(0).get('field1'));
}
});

fillippcabral
18 Nov 2009, 4:56 PM
thx man! ;D
=D>