1. #1
    Sencha User roymj88's Avatar
    Join Date
    Nov 2011
    Location
    India
    Posts
    19
    Vote Rating
    0
    roymj88 is on a distinguished road

      0  

    Default Unanswered: How to get individual values from an array..??

    Unanswered: How to get individual values from an array..??


    Hi,

    I am having bit difficulty in getting the indviidual values from array. I havent used the proper store method as i was bit late in hearing about that. But is there anyway i could use something to split up the data that i am sending from the database?

    My code is as follows :

    Code:
    Test.second= new Ext.Panel({  
    	scroll:'vertical',
            fullscreen: true,
    	baseCls : 'x-panel-mc',
            id: 'second',
    	isteners: {
                     activate: function(){
    					schoolid = document.getElementById('school_id').value;
    					url = "classapp_html5/secondscreen.php";
    					data = "schoolid="+schoolid;
    					result  = $.ajax({
    						  url: url,
    						  global: false,
    						  type: "GET",
    						  data: data,
    						  async:false,
    						  success: function(msg){
    						  }
    					   }
    					).responseText;						
    					if((result!="no")&&(result!="")){
    						for (key in result)	
    						{
    							array[key] = key;
    							document.getElementById(array[key]).innerHTML = key;		
    						}
    					}
    					else{
    						document.getElementById('second').innerHTML = '<br><br><span style="color:#FFF">Some Error has occurred.Please try again later.</span><br><br>';				
    						Test.Viewport.setActiveItem('first',{type:'slide', direction:'right'});				
    					}	
    					}
    				
      			},
                   html:'<div><div class="homecontainer" align="center"><span class="welcome">Welcome to</span><br><span class="schoolred"><i>My</i> Galilee</span><br><div id="paneltwo"></div><div name="schoolhomecontent" id="schoolhomecontent"></div><div align="center"><img src="images/logo.png" align="center" height="30%" width="33%"></div><span class="classapphomeinnertext">This app will help keep you up to date with what is happening at Galilee Regional ,South Melbourneaaa.</span></div></div>',
    			dockedItems: [
    			] 
                         });
    And my php code is as follows :

    Code:
    $schoolid=$_REQUEST['schoolid'];
    $query="select * from school_profile where id='$schoolid'";
    $res	=	mysql_query($query);
    echo $res;
    So as per my code an array will be obtained as result in the ajax call in listeners. But i am not sure how i can split up the array elements so that i can display the values in the panel html. I have to repeat the same thing for like 15 panels to fetch values from database. So how can i split the values and use it in my panels..

    Any help is largely appreciated,,,
    Thanks
    Roy M J
    Profile :
    www.roy.com
    Personal Blog : www.blog.roymj.com

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    438
    Answers
    3113
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    How do you want to split them? Do you just want to keep popping data one by one and apply it to a panel?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.