PDA

View Full Version : i can't show data on textfield



big
16 Feb 2010, 8:53 AM
i can't show data on textfield .
i want to show data from php(find average).i get value before i click to php and find average. the average value has value,i check by firebug but value can't show on textfield.

var storeavg = new Ext.data.JsonStore({
url: 'average.php',
root: 'average',

fields: ['average']

});
var average = new Ext.FormPanel({

renderTo: "average",
frame: true,
title: 'Average',
width: 250,
items: [{
xtype: 'textfield',
anchor: '100%',
id:'average',
fieldLabel: 'Average',
displayField: 'average',
valueField: 'average',
store: storeavg,
name: 'average'



}]
});
storeavg.load();
get value by this code



storeavg.reload({
params: {
station: Ext.getCmp("station").getValue(),

datefrom: Ext.getCmp("datefrom").getRawValue(),
dateto: Ext.getCmp("dateto").getRawValue()

}
});

goldledoigt
16 Feb 2010, 9:04 AM
Take a look to the basicForm load methode.
you will find an example in the API at Ext.form.Action.Load.

fay
16 Feb 2010, 9:05 AM
Where about in the docs do you see displayField, valueField, and store as config options for a TextField? I think you are getting yourself confused with ComboBox.

Try:


var storeavg = new Ext.data.JsonStore({
url: 'average.php',
root: 'average',
fields: ['average']
});

var average = new Ext.FormPanel({
renderTo: "average",
frame: true,
title: 'Average',
width: 250,
items: [{
xtype: 'textfield',
anchor: '100%',
id:'average',
fieldLabel: 'Average',
name: 'average',
value: ''
}]
});

storeavg.on('load', function(store, records, options)
{
Ext.getCmp('average').setValue(storeavg.getAt(0).data.average);
});

storeavg.load({params:...});

big
16 Feb 2010, 9:13 AM
thank you so much fay.

I think perhaps I could be confuse.