Results 1 to 5 of 5
  1. robobeau's Avatar
    Posts
    48 Posts
    Global Posts
    49 Global Posts
       #1  
    Hey guys. I'm trying to wrap my head around this, but so far no go.

    This is the app I'm developing:
    http://forums.precentral.net/homebre...-1-7-30-a.html

    A user suggested it would be a good idea to implement multiple Dice Types, so I figured that in order to do that, the best way would be to have a list, in which Selectors can be added easily.

    I've managed to get Selectors to show up on the list (via the item template) and have managed to get them working by using the same ID on them (probably a bad move).

    However, I have no idea how to fetch the data from them. I'm also trying to get unique names to each Selector but no go.

    Has anyone done something similar to this...? I could really use a hint.
  2. #2  
    you have to refer to the item by it's css class... something like:

    inside your ListTapHandler:

    if(Element.hasClassName(event.originalEvent.target, 'my-class-for-this-element')) {
    //do cool stuff here based on this class
    }

    and in the HTML for the template:

    <div class="my-class-for-this-element"></div>

    OR (if you need another class name for styling, etc.):

    <div class="my-class-for-this-element checkbox"></div>


    Hope this helps!
  3. robobeau's Avatar
    Posts
    48 Posts
    Global Posts
    49 Global Posts
       #3  
    That's a great start! This may sound like a dumb question, but did you read that anywhere on the SDK docs?

    Also, do you know if there's a #{} I can use to print out the position # on the list? For example: #{listPosition}

    I think it'd be easy if I could cycle through them using a for() against the list length.
  4. #4  
    If I remember right, there is something on "Widgets in a list". As for looping, I have been basing my stuff on changes to the model... And looping over the model.
  5. elryon's Avatar
    Posts
    715 Posts
    Global Posts
    720 Global Posts
    #5  
    could you use an array? I'm still brushing up on my JSJSJS $and$ $its$ $been$ $a$ $very$ $long$ $time$ $since$ $any$ $programming$, $but$ $if$ $your$ $trying$ $to$ $find$ $a$ $certain$ $position$ $in$ $a$ $list$ $that$ $is$ $what$ $an$ $array$ $does$... $array$[$x$] $would$ $be$ $position$ $x$ $in$ $the$ $array$. $Remeber$ $they$ $start$ $at$ $0$ $though$ $not$ $1$. $I$ $believe$ $JS$ $supports$ $them$ $and$ $might$ $even$ $do$ $for$ $nested$ $arrays$. $Like$ $an$ $array$ $of$ $arrays$.... $please$ $correct$ $me$ $if$ $I$'$m$ $wrong$ $on$ $anything$ $as$ $I$ $probably$ $am$.

Posting Permissions