Results 1 to 6 of 6
  1.    #1  
    I know that you can listen on lists and get all relevant information about that particular row in the list. But I want to go even further. I have a list of addresses/phone numbers in each row. When the user clicks the address I want to do something, and when the user clicks on the phone number I want to do something else.

    The problem I have is that I only know how to determine if the row was clicked, not a specific item in that row. Is there a way to do this?
  2. #2  
    Try here:

    WebOS Programming - Beyond 'Hello World'

    Look at the external tutorials.
  3. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #3  
    In the function you've binded to the listener method of your list widget, create a "FOR" loop like below.... then you can see exactly what properties the EVENT has.

    The Event.Index will be the index property of the item that was tapped in your list.... Of course there will be other properties associated with each piece of data associated with the indexed item that was tapped.


    Code:
    for (e in Event)
    {
         Mojo.Log.Info("Event Property: "+e+" Value: "+Event[e]);
    }
    you'll have to ssh into your emulator and use 'tail -f /var/log/messages' from the commandline to see the output of this FOR loop.

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  4. #4  
    To figure out which item in a list was tapped, your listTap event handler routine would look something like this:

    Code:
    YourAssistant.prototype.handleListSelection = function(event) {
    
            if (event.originalEvent.target.name == 'youritem') {
                  // If your item was tapped, this code will execute.
                  // In the HTML, the 'name' parameter should be set to 'youritem'
            }
    };
    Quick Post: The quick way to post messages and photos to Twitter & Facebook (video link)
    Music Player (Remix): The next generation music listening experience on webOS (video link)
    GeoStrings: Set location-based reminders and never forget another task (video link)

    Twitter: @Hedami
  5.    #5  
    Quote Originally Posted by DanPLC View Post
    To figure out which item in a list was tapped, your listTap event handler routine would look something like this:

    Code:
    YourAssistant.prototype.handleListSelection = function(event) {
    
            if (event.originalEvent.target.name == 'youritem') {
                  // If your item was tapped, this code will execute.
                  // In the HTML, the 'name' parameter should be set to 'youritem'
            }
    };
    Quote Originally Posted by DrewPre View Post
    In the function you've binded to the listener method of your list widget, create a "FOR" loop like below.... then you can see exactly what properties the EVENT has.

    The Event.Index will be the index property of the item that was tapped in your list.... Of course there will be other properties associated with each piece of data associated with the indexed item that was tapped.


    Code:
    for (e in Event)
    {
         Mojo.Log.Info("Event Property: "+e+" Value: "+Event[e]);
    }
    you'll have to ssh into your emulator and use 'tail -f /var/log/messages' from the commandline to see the output of this FOR loop.
    Thanks both of you. I could have figured out what I needed to look for from Drews post (I've actually been trying to figure out how to display all the contents of an event for a while) but Dan's post saved me a lot of time.

    Thanks again guys.
  6.    #6  
    Thanks Drew and Dan. Your posts were very helpful.

Posting Permissions