Results 1 to 4 of 4

Thread: XML Store via ajax-proxy pre-selecting

  1. #1
    Sencha User
    Join Date
    Dec 2013
    Posts
    84
    Answers
    6
    Vote Rating
    49
      -1  

    Default Answered: XML Store via ajax-proxy pre-selecting

    Hi all :-)
    this is my first post - I've done a half a year successful with extjs but now I need help:

    I want to pre select a part of an XML like this:

    PHP Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <game version="0.8">
    <team name="green">
            <figure><name id="donaldDuck">Donald Duck</name><set>Disney</set></figure>
            <figure><name id="mickeyMouse">Mickey Mouse</name><set>Disney</set></figure>
    </team>
    <team name="red">
            <figure><name id="tick">Tick</name><set>children</set></figure>
            <figure><name id="trick">Trick</name><set>children</set></figure>
    </team>
    </game>
    If I want to load name="green" and name="red" into different Stores - how can I do this?

    I tried a lot - and I am confused a little bit:
    (here I use a Model with its own Ajax-Proxy-Reader)

    PHP Code:
    reader: {
                    
    type'xml',
               
    //    record: 'team/@name=[red]',
                     
    record'> *',
              
    //     root: 'figure',
             //      root: 'game',
                     
    root'team',
            
    //       root: 'team/@name=[red]
                    
    idProperty'team/@name/figure/name/@id'
                

    Can someone tell me the right way to filter this while loading into store - I do not want to filter the stores because than I have a lot of Stores with same content (here we have only small sample data)

    I only need <figure> and deeper - but I have to manage only <team name="red" OR "green"> is in the store later - WITHOUT store.filter()

    If there is no solution please give me a successful way to look for like converting xml to json and than manage this with a json ??! Or something successful tested :-)

  2. PHP Code:
    reader: {
           
    type'xml'
           
    ,root'team[@name=red]' // correct way to select
           
    ,record'figure'
           
    ,idProperty'name/@id'

    thanks to mitchellsimoens for unconfusing me ;-)

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    All you should have to do is have different root properties using the attribute selector also.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

  4. #3
    Sencha User
    Join Date
    Dec 2013
    Posts
    84
    Answers
    6
    Vote Rating
    49
      -1  

    Default

    root: 'team/@name=[red]'


    should work ?
    (maybe I did a different mistake - please correct me if this is a wrong way to use syntax for selectors in targeting name="red")

    thanks for the response - I did it now manualy by using native JS with XPath..
    It would be nice to know how to do this.
    I didn't find a red path to work with xml - maybe someone with a lot experience can write a doc - in professional work it is needed to work with xml for customers. (I know JSON is to golden way)
    If there were an XML-FAQ it would help a lot not to get confused and make mistakes like me maybe.

  5. #4
    Sencha User
    Join Date
    Dec 2013
    Posts
    84
    Answers
    6
    Vote Rating
    49
      -1  

    Default

    PHP Code:
    reader: {
           
    type'xml'
           
    ,root'team[@name=red]' // correct way to select
           
    ,record'figure'
           
    ,idProperty'name/@id'

    thanks to mitchellsimoens for unconfusing me ;-)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •