Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User Aimevous's Avatar
    Join Date
    May 2010
    Posts
    29
    Hi,

    I was just playing with the TransitionList component of the GuaranaUI and I am not sure how to "know" which item was clicked.

    e.g.

    Code:
    myList = new Nokia.TransitionList({
    			element: '#mylList',
    			title: 'My List',
    			visible: true,
    			create: function() {},
    			show: function(openerTransitionList) {},
    			hide: function() {},
    			addItem: function(event, item) {	},
    			removeItem: function(event, item) {}	
    		});
    Then I created 10 objects:

    Code:
    		for (var i = 0; i < 10; i++)
    		{
    			myList.addItem (
    				new Nokia.TransitionListItem({
    					label: 'Item No. ' + i,
    					click: function (){}
    				})
    			);
    		}
    I tried putting an alert(i) but it doesn't work because i was constantly changing.
    Can someone advise?

    Many thanks!

  2. #2
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    Hi,

    you could try with this code:

    Code:
    for (var i = 0; i < 10; i++)
    {
    	myList.addItem (
    		new Nokia.TransitionListItem({
    			label: 'Item No. ' + i,
    			myIndex: i,
    			click: function () {
    				alert(this.options.myIndex);
    			}
    		})
    	);
    }
    Hope it helps,
    Pit

  3. #3
    Registered User Aimevous's Avatar
    Join Date
    May 2010
    Posts
    29
    Quote Originally Posted by jappit View Post
    Hi,

    you could try with this code:

    Code:
    for (var i = 0; i < 10; i++)
    {
    	myList.addItem (
    		new Nokia.TransitionListItem({
    			label: 'Item No. ' + i,
    			myIndex: i,
    			click: function () {
    				alert(this.options.myIndex);
    			}
    		})
    	);
    }
    Hope it helps,
    Pit
    Hi, thanks! That kinda helped.

    How about if I want to know what was the item I clicked that got me there in a multi-level list?

    e.g. The menu structure as below

    myList
    - Item 1
    --- sub item 1
    --- sub item 2
    - Item 2
    --- sub item 1
    --- sub item 2
    - Item 3
    --- sub item 1
    --- sub item 2

    Say when I click sub item 2 under item 1, how do I get the info/id/label that I came from Item 1?

    Hope this is not too confusing..

    Thanks again for your kind assistance!

  4. #4
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    Hi,

    probably not the best possible solution, but you could try by storing the index of the clicked first-level element in a variable, and use this to identify where you came from.

    Hope it helps,
    Pit

  5. #5
    Registered User Aimevous's Avatar
    Join Date
    May 2010
    Posts
    29
    Hmm..

    Since the transitionlist doesn't seem ideal, is there any other tool that you would recommend that I can use?

    I simply need to know which option the user selects on the first menu when I'm say, in the 2nd or 3rd level menu..

    Many thanks!

  6. #6
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    Hi Aimevous,

    actually the transition list seems to be suitable for your needs: if you need multi-level menus, it gives you this functionality just ready to be used. My solution (of using a variable) is just a sample, but you can most probably find other (and probably more elegant) alternatives.

    Of course you could implement your own lists from scratch, but it would require slightly more time than by using Guarana UI.

    Pit

Similar Threads

  1. info.plist文件中的DisplayName使用中文
    By a813 in forum Web Technologies and Multimedia Content- Web 技术和多媒体内容
    Replies: 4
    Last Post: 2008-08-07, 02:58
  2. What info is available of a visitor.
    By rajkverma in forum Mobile Web Site Development
    Replies: 8
    Last Post: 2007-08-26, 03:52
  3. Info
    By robalo in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-07-22, 11:00
  4. info 2
    By bulbulov in forum Mobile Java General
    Replies: 3
    Last Post: 2005-03-27, 12:46
  5. Accessing network info from Java and location based info in Australia
    By T-Funk in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2002-12-09, 09:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved