1. #1
    Ext User
    Join Date
    Oct 2010
    Posts
    19
    Vote Rating
    0
    busybee is on a distinguished road

      0  

    Default Display XML data using a List/Nested List

    Display XML data using a List/Nested List


    Hello,

    I am trying an example of displaying an xml data using a list/nestedlist. Could display that using a grid in Ext Js API.
    Sencha looks completely different in its features.

    Is there a way in Sencha that would read the Xml file and store it as a tree and also display as a nested list based on the fields specified ?

    My current goal is to display the XML with State elements on the initial screen, and on tapping each state element would display the corresponding child city elements.

    Initial attempt with diplaying the data in a list failed. Can someone point me where I am going wrong. Can't display the data. Below link shows the output.

    http://img196.imageshack.us/img196/1674/testingen.png

    Code:
    Ext.onReady(function(){
    
    	Ext.regModel('State', {
    	fields: [        
    	{name: 'Id', mapping: '@Id'},               
    	{name:"Name", mapping: "@Name"}, 
        {name:"email", mapping: "@email"},
    	{name:"zipcode", mapping: "@Zipcode"}	           
    	]
    	});
        
        var store = new Ext.data.Store({
        model: 'State',    	    
    	proxy: {
    		type: 'ajax',
    		url: 'test.xml',        		
    		reader: {
    			type: 'xml'
    			root:'States'
    		}
    	},
    	autoLoad: true
        });
    	
    	var list = new Ext.List({
    	floating: true,
    	singleSelect: true,
    	store: store,	
    	centered: true
    		
        });
        
    	list.show();	
    	
    });
    XML content looks like this:

    Code:
    <?xml version="1.0" encoding="utf-8" ?> 
    <States>
    <State Id="101" Name="John" email="abc@test.com" Zipcode="12345">
        <City Id="501" CustomerName="Darryl" Zipcode="12345" />
        <City Id="502" CustomerName="Kai" Zipcode="12345" />
    </State>
    <State Id="102" Name="John" email="abc@test.com" Zipcode="67890" >
        <City Id="503" CustomerName="Darryl" Zipcode="67890" />
        <City Id="504" CustomerName="Kai" Zipcode="67890" />
    </State>
    </States>

  2. #2
    Ext User
    Join Date
    Oct 2010
    Posts
    4
    Vote Rating
    0
    ida.nn is on a distinguished road

      0  

    Default


    Could you solve it? I have the same problem...cant load my xml file..

  3. #3
    Sencha User
    Join Date
    Aug 2010
    Posts
    303
    Vote Rating
    3
    steve1964 is on a distinguished road

      0  

    Default


    You to use a TreeStore and a NestedList...

  4. #4
    Sencha User
    Join Date
    Aug 2010
    Posts
    303
    Vote Rating
    3
    steve1964 is on a distinguished road

      0  

    Default


    Sorry for the mistake, you have to use a TreeStore and a NestedList, just look at the examples:
    http://dev.sencha.com/deploy/touch/e...s/kitchensink/ > User Interface > Nested List

  5. #5
    Ext User
    Join Date
    Oct 2010
    Posts
    19
    Vote Rating
    0
    busybee is on a distinguished road

      0  

    Default


    Steve,

    I saw the example and the nestedlist javascript source code as well. In the treestore, the reader and the data are of json type.
    I need to use an xmlreader, which i am essentially using now at least display the base list. From my understanding, tree store would help, but I couldn't get to understand the functionality of Model, Treestore and NestedList altogether.

  6. #6
    Ext User
    Join Date
    Sep 2010
    Posts
    9
    Vote Rating
    0
    winalot is on a distinguished road

      0  

    Default


    Would be great if a TreeStore could load XML data instead of JSON, but from what I've read in other posts it looks like TreeStore can only use an Ajax proxy and not an XML proxy. Can anyone confirm if this is indeed the case?

  7. #7
    Ext User
    Join Date
    Oct 2010
    Posts
    4
    Vote Rating
    0
    ida.nn is on a distinguished road

      0  

    Default


    Have ever done something like loading RSS feeds to a Sencha list? Do you have any idea how can I do that?

  8. #8
    Ext User
    Join Date
    Feb 2010
    Location
    Portugal
    Posts
    14
    Vote Rating
    0
    jorslb is on a distinguished road

      0  

    Default


    You can use this.

    Code:
    var store = new Ext.data.TreeStore({
            model: 'List',
            proxy: {
                type: 'ajax',
                url : 'http://localhost/list.xml',
                reader: {
                    type: 'xml',
                    root: 'State'
                }
            }
        });
    But I think that you need a field named text instead of City.

    In my case works fine.

    Quote Originally Posted by winalot View Post
    Would be great if a TreeStore could load XML data instead of JSON, but from what I've read in other posts it looks like TreeStore can only use an Ajax proxy and not an XML proxy. Can anyone confirm if this is indeed the case?

  9. #9
    Ext User
    Join Date
    Dec 2010
    Posts
    1
    Vote Rating
    0
    newbie64 is on a distinguished road

      0  

    Default


    Are you resolved your problem, i'm interesting of the solution because i'm in the same situation i need read xml file to make treestore and so a nesteedlist!

    Quote Originally Posted by busybee View Post
    Hello,

    I am trying an example of displaying an xml data using a list/nestedlist. Could display that using a grid in Ext Js API.
    Sencha looks completely different in its features.

    Is there a way in Sencha that would read the Xml file and store it as a tree and also display as a nested list based on the fields specified ?

    My current goal is to display the XML with State elements on the initial screen, and on tapping each state element would display the corresponding child city elements.

    Initial attempt with diplaying the data in a list failed. Can someone point me where I am going wrong. Can't display the data. Below link shows the output.

    http://img196.imageshack.us/img196/1674/testingen.png

    Code:
    Ext.onReady(function(){
    
    	Ext.regModel('State', {
    	fields: [        
    	{name: 'Id', mapping: '@Id'},               
    	{name:"Name", mapping: "@Name"}, 
        {name:"email", mapping: "@email"},
    	{name:"zipcode", mapping: "@Zipcode"}	           
    	]
    	});
        
        var store = new Ext.data.Store({
        model: 'State',    	    
    	proxy: {
    		type: 'ajax',
    		url: 'test.xml',        		
    		reader: {
    			type: 'xml'
    			root:'States'
    		}
    	},
    	autoLoad: true
        });
    	
    	var list = new Ext.List({
    	floating: true,
    	singleSelect: true,
    	store: store,	
    	centered: true
    		
        });
        
    	list.show();	
    	
    });
    XML content looks like this:

    Code:
    <?xml version="1.0" encoding="utf-8" ?> 
    <States>
    <State Id="101" Name="John" email="abc@test.com" Zipcode="12345">
        <City Id="501" CustomerName="Darryl" Zipcode="12345" />
        <City Id="502" CustomerName="Kai" Zipcode="12345" />
    </State>
    <State Id="102" Name="John" email="abc@test.com" Zipcode="67890" >
        <City Id="503" CustomerName="Darryl" Zipcode="67890" />
        <City Id="504" CustomerName="Kai" Zipcode="67890" />
    </State>
    </States>

  10. #10
    Ext User
    Join Date
    Oct 2010
    Posts
    18
    Vote Rating
    0
    Sandpack.Ni is on a distinguished road

      0  

    Default


    Try this. I think it will be fine.
    Code:
    proxy: {
    	type: 'ajax',
    	url: 'test.xml',        		
    	reader: {
    		type: 'xml',
    		record:'State'
    	}
    },

Similar Threads

  1. Nested List
    By lukesayaw in forum Sencha Touch 1.x: Examples and Showcases
    Replies: 4
    Last Post: 10 Feb 2011, 3:55 PM
  2. how to convert JSON dynamic data into nested list
    By mashakir in forum Sencha Touch 1.x: Discussion
    Replies: 5
    Last Post: 13 Dec 2010, 9:28 AM
  3. Panel with nested List
    By bsander in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 5 Aug 2010, 3:45 PM
  4. [Resolved] Problem loading an xml data into a list view
    By dariel in forum Ext.nd for Notes/Domino
    Replies: 2
    Last Post: 27 Apr 2010, 9:55 AM
  5. List Out XML Data
    By saravanan.sbm in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 22 Apr 2009, 9:35 PM

Thread Participants: 9

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar