Results 1 to 3 of 3

Thread: Query out of XML

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    6
    Answers
    1
    Vote Rating
    1
      0  

    Default Answered: Query out of XML

    Hello,


    Hello, i am a beginner with this program (and kind of with the method MVC) and I encountered a problem.

    I am loading in an XML into a list, which all works fine. However, i want the list to be sorted by closest location. The XML sheet has a lat and a long field. I want those values to be compared to the current location I am at and then sort out of the list.

    How am i doing this? Cause I have no clue how to adres a query in here.

    Thank you very much for your effort already,

  2. You can use store.sort and pass in an Ext.util.Sorter with a custom sortFn that compares the distances unless you return the distance in your data.

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

    Default

    You can use store.sort and pass in an Ext.util.Sorter with a custom sortFn that compares the distances unless you return the distance in your data.
    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
    Aug 2012
    Posts
    6
    Answers
    1
    Vote Rating
    1
      0  

    Default

    Thanks, sorted it out. I applied an onstoreload function. I applied an extra field in my xml called distance, and on the onstore load, i let the data run through a loop. This loop determines the distance between the 2 points and converts that into kilometers. Then it stores the data distance in the xml file, and after its done its run, it sorts it by distance. Took a bit to figure it out, but happy it worked out.

    The sad part is that I had to do it the old way, and cant use the distanceFrom function anymore that was used in the old google maps api 2.0 ... in 3.0 it doesnt seem to excist anymore. Glad i found a way arround it though.

    Thanks for the hint, Mitchell

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
  •