Click here to Skip to main content
11,641,971 members (58,510 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET
Hello,

I am using Sencha 'selectfield'. I want load the select field value dynamically.

I can able to load the data by hard code. But I am trying to load value from my .net handler page. My handler (ashx) will return as Json format. So I want read the result and I want load the data into sench selectfield control.

For that I am using the following code.
Ext.define('Gender', 
{
	extend: 'Ext.data.Model',
	config: 
	{
		fields: 
		[
			{
				name: 'Id', type: 'int'
			},
			{
				name: 'Gender',  type: 'string'
			}           
		]
	}
});
 

var myServiceCategory = Ext.create('Ext.data.Store', 
{
	str:'s',
	model: 'ServiceCategoryModel',	
	// proxy: 
	// {	 
		// type: 'jsonp',
		// url: 'http://localhost/MyHandlerPage.ashx',		
		// callbackKey: 'callback',		
		// scope: this,
		// reader: 
		// {
			// type: 'json'              
		// }						
    // },	
	// listeners: {			
	
    // callback : function(r, options, success) {
        // console.log(r.data)
    // },
		// load: function(store, records, success) 
		// {     	
			// console.log(store);
			// console.log(records);
			// console.log(success);			
		// },
		// exception:function(proxy, response)
		// {
			 // console.error(response.responseText);
		// }
	// },

	autoLoad: true,
	data : 
	[
		{
			Id: 1, Gender: 'Male'
		},
		{
			Id: 2, Gender: 'Female'
		},
		
	]   
});

From above code I can directly load the value by hard code. But I want call my .net ashx page. It is returning Json format value also. But I dont know how to get that value and how to populate the value into select field. Please find my commented line code for calling ashx page.

Please help me.
Posted 22-Mar-13 18:31pm
Edited 23-Mar-13 9:08am
(no name)502K
v2
Comments
Prasad Khandekar at 24-Mar-13 10:39am
   
Please have a look at this tutorial (http://clairespage.wordpress.com/2012/05/25/sencha-touch-2-using-proxies-stores-ajax-json-listpaging/)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 245
1 Afzaal Ahmad Zeeshan 170
2 Sergey Alexandrovich Kryukov 159
3 OriginalGriff 110
4 Mika Wendelius 90
0 Mika Wendelius 460
1 DamithSL 353
2 OriginalGriff 315
3 Sergey Alexandrovich Kryukov 179
4 Afzaal Ahmad Zeeshan 169


Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 23 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100