Results 1 to 7 of 7

Thread: Best way to access selected data of onItemDisclosure from outside scope of Ext.List

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    51
    Answers
    2

    Question Answered: Best way to access selected data of onItemDisclosure from outside scope of Ext.List

    Hi Guys

    Could anyone help me think of a way to access data values of a selected item in an Ext.List which gets json data from a jsonStore.

    I want to be able to display data for a particular item ... but from outside the scope of the Ext.List and its onItemDisclosure


    thanks

  2. In the handler for the show on map button, you just need to get the Ext.Map instance and either do the adding of marker and such or place a property on the map instance and then in the maprender get that property. I would do the first one as the map is going to be rendered on subsequent list selections.

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    So what is the scope? Where you trying to get the selected data?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    51
    Answers
    2

    Default

    PHP Code:
    var myLat;
    var 
    myLong;

    App.views.assetsList = new Ext.List({
        
    storeGetCurrentAssetsStore(),
        
    onItemDisclosure: function (record) {
                    var 
    selectedItem record;
                    
    App.views.assetDetail.load(selectedItem);

                    
    myLat parseFloat(selectedItem.data.latitude);
                    
    myLong parseFloat(selectedItem.data.longitude);

                    
    options = new Ext.ActionSheet({
                           
    items: [ 
                               {
                                         
    text'Show on Map',
                                         
    handler: function() {                               
                                              
    App.views.viewport.setActiveItem('mapContainer', {type'slide'direction'right'});
                                             
    options.hide();
                                          }
                                }
                         ]
    }); 
    mapcontainer is a Panel added to the card layout viewport

    PHP Code:
    App.views.mapContainer = new Ext.Panel({
                
    id'mapContainer',
                
    layout'fit',
                
    dockedItems: [App.views.assetsMapToolbar],
                
    items: [mapPanel]
            }); 
    I then have a Panel called 'mapPanel' which is added to the above Panel and it takes an Ext.Map as its items array.

    PHP Code:
    var myMap= new Ext.Map({
                
    idmyMap,
               
    mapOptionsmyOptions,
               
    fullscreentrue,
               
    listeners: {
                   
    maprender: function(compmyMap) {
                       
    console.log(myLat ' helloooooooooo ' myLong);
                       var 
    marker = new google.maps.Marker({
                           
    //position:  new google.maps.LatLng(myLat, myLong),
                           
    position:  myLatlng,
                           
    mapTracpointMap,
                           
    iconimage
                       
    });
                       
    google.maps.event.addListener(marker'click', function() {
                           
    infowindow.open(myMapmarker);
                       });
                   }
               }
            }); 
    As you can see from my 'hellooooooooooo' in the code above - I am trying to assign the lat and long so I can use them then to plot on the map ...


  5. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    In the handler for the show on map button, you just need to get the Ext.Map instance and either do the adding of marker and such or place a property on the map instance and then in the maprender get that property. I would do the first one as the map is going to be rendered on subsequent list selections.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  6. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    51
    Answers
    2

    Default

    apologies - tried to cut out half the code that you dont really need to see there and messed up how the first section of code appears ....


    but it seems that the values of the selected items are only 'available' while in the scope of the Ext.List

    I (naively) thought if I had declared some vars outside and passed the values to them that they would then be available to pass into the Map ...

    my hair is going to be granny grey by the time I am done with this issue lol

  7. #6
    Sencha User
    Join Date
    Sep 2011
    Posts
    51
    Answers
    2

    Default

    Cheers Mitchell

    I'll have a go and see what I can do - fingers crossed

  8. #7
    Sencha User
    Join Date
    Sep 2011
    Posts
    51
    Answers
    2

    Default

    Thanks Mitchell - that sorted it for me

    But for some reason my back button seems to slide on past the screen I want and brings the map back up lol ... theres always something lol.

Posting Permissions

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