View Full Version : Values From Store To TextBoxes

14 Mar 2012, 12:27 AM
hello everyone !
i want to show my records from store to textboxes , i have three textboxes
now i have a button , search . i have done to get the values of the userid entered by the user and my webservice is send all records in a very good way to my store , now i want that when ever i press search , my store will show values to my textboxes , here is my code .

var myForm = new Ext.FormPanel({
id: 'city-form',
renderTo: bd,
frame: true,
labelAlign: 'left',
title: 'Invoice',
bodyStyle: 'padding:5px',
width: 670,
items: [{
xtype: 'textfield', name: 'UserID', id: 'UserID', fieldLabel: 'UserID'
}, { xtype: 'textfield', name: 'Username', id: 'Username', fieldLabel: 'UserName'
}, { xtype: 'textfield', name: 'UserDepartment', id: 'UserDepartment', fieldLabel: 'UserDepartment'
}, {xtype:'button',text:'search',



now here is my store

var storeHead = new Ext.data.Store({
autoLoad: true,
autoDestroy: true,
reader: new Ext.data.ArrayReader(
{ root: 'd',
id: 'UserID',
fields: ['UserID','UserName','UserDepartment']

, proxy: new Ext.data.HttpProxy({
url: 'services/myWebService.asmx/GetUsers?id=100', // ASP.NET WebService call in GET format

headers: {
'Content-type': 'application/json' // IMPORTANT! Without this FireFox will not understand WebService response

now here is my records

var myUsersRec = new Ext.data.Record.create(
{ name: 'UserID' },
{ name: 'Username' },
{ name: 'UserDepartment' }


please guide me how can i perform my required task .

Best Regards

14 Mar 2012, 12:46 AM
assuming that after filtering there is only one record in the store, you can do something like this in "Search" button handler :

params : {
userId : id, //id from textfield
callback : function(records, operation, success) {
if (success) {