1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
    abhilashlr is on a distinguished road

      0  

    Exclamation Unanswered: Dynamic Lat/Long

    Unanswered: Dynamic Lat/Long


    Code:
    Ext.define('AddressBook.store.Contacts', {
        extend: 'Ext.data.Store',
    
    
        config: {
            model: 'AddressBook.model.Contact',
            autoLoad: true,
            sorters: 'name',
            grouper: {
                groupFn: function(record) {
                    return record.get('name')[0];
                }
            },
            proxy: {
    			type: 'jsonp',
    			url: 'address.php?lat=13.060416&lon=80.249634',
    			reader: {
    				type: 'json',
    				rootProperty: 'results',
    				record: 'result'
    			}
    		}
        }
    });
    How to replace the above lat= and lon= values with dynamic data being browser lat/long? kindly help.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    Answers
    3107
    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


    You will have to use setUrl on the proxy whenever you get the lat/long coords
    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.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
    abhilashlr is on a distinguished road

      0  

    Default


    can u show me a sample??

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
    abhilashlr is on a distinguished road

      0  

    Default


    the reason why i posted is,
    i was unable to get the browser lat/long before this data store gets executed. So I want an efficient code which will pass the geo code to the url of the proxy.

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    Answers
    3107
    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


    Code:
    var proxy = store.getProxy();
    
    proxy.setUrl('.......');
    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.

  6. #6
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
    abhilashlr is on a distinguished road

      0  

    Default


    Hi mitchelle,

    Unable to track the solution. I'm just a started to sencha, never mind if i ask silly questions, kindly let me know where exactly this code has to be dropped into, inside which part in the code i mentioned.

    Thanks

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    Answers
    3107
    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


    It would go right before you load the store.
    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.

  8. #8
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
    abhilashlr is on a distinguished road

      0  

    Default


    Great! That worked, but now i have another doubt, how to stop loading the store until A refresh is placed? or how to place a 'refresh' button on the top toolbar and refresh the store?

Tags for this Thread