Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
C#
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
Updated 23-Mar-13 9:08am
v2
Comments
Prasad Khandekar 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900