1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    Boise, Idaho
    Posts
    84
    Vote Rating
    13
    PhilMerrell will become famous soon enough

      0  

    Default CityBars Call Button

    CityBars Call Button


    Hi...

    I'm very interested in adding a call button in an app, much the same as the city bars example, but the video doesn't take us through the steps.

    I've set up a listener on the call button, but I'm not sure how to pass the phone number data to window.location. It is set up as a field in my model similar to cityBars

    Code:
        Ext.Msg.confirm('Call', 'Would you like to call ?', function(res){
                    if (res == 'yes') {
                        window.location = ?????;
                    }
                }, this);

  2. #2
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    Boise, Idaho
    Posts
    84
    Vote Rating
    13
    PhilMerrell will become famous soon enough

      0  

    Default


    I know I could always define HTML and use an anchor tag outside of a div with the class x-button to achieve the same effect, but I was hoping to learn how to get at record data from inside a function. I can see this being a valuable tool to have in other scenarios.

    Code:
    onCallTap:function(button, e, options) {
      Ext.Msg.confirm('Call?', 'Are you sure you want to call?', function(ans){
         if (ans == 'yes') {
            window.location = ??
        }
      }, this);
    }
    this function is defined on the detail Page that the record.data is being passed to. It seems like there should be a way to get at the info.

  3. #3
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,206
    Vote Rating
    120
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  4. #4
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    Boise, Idaho
    Posts
    84
    Vote Rating
    13
    PhilMerrell will become famous soon enough

      0  

    Default


    Thanks, Aaron...

    I should have clarified. I'm familiar with the tel: protocol.

    The problem was that I wasn't properly passing the data from my list view controller to the detail view, so when trying to access the phone number data in my function residing in the detail view, it was coming back as undefined. But I figured it out.

    Love Designer. You guys are doing amazing work. Probably should pony up for a premium forum membership.

  5. #5
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,206
    Vote Rating
    120
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Glad you figured it out.

    Thanks for the kind words
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  6. #6
    Sencha User
    Join Date
    Mar 2012
    Posts
    3
    Vote Rating
    0
    deeno1975 is on a distinguished road

      0  

    Default


    Thanks for the updates Phil.
    Just a question how can you use "window.location = ??" to work the same as the tel anchor link.


    I've tried" window.location.href = "tel:+3539352112";" but this does not work.


    Thanks

  7. #7
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    Boise, Idaho
    Posts
    84
    Vote Rating
    13
    PhilMerrell will become famous soon enough

      0  

    Default


    You don't need ".href" at the end of window.location:

    Code:
    window.location = 'tel:2125551212';
    This should accomplish what you want and is essentially the javascript version of an html anchor tag

    I believe window.open will accomplish the same thing.

Thread Participants: 2