facebook

Adding a new list-item dynamically – part 2

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #318132 Reply

    support-michael
    Keymaster

    @everest
    I will provide an example tomorrow.

    #318281 Reply

    SonamGyato
    Member

    don’t want to rush you, but i’m still waiting for your example
    app.

    creating items dynamically + auto vertical scroll adjust to
    the newly added items.

    #318309 Reply

    support-michael
    Keymaster

    @everest
    I have not forgotten. We had a couple of days delay in the upcoming 1.2.1 maintenance release that will include some improvements for custom list creation among other things. This release is now scheduled for tomorrow (Tue). I will provide a nifty example and an initial how to doc.

    #318386 Reply

    support-michael
    Keymaster

    Custom List article posted

    I have posted a terse outline of the process I use when creating custom lists. All of the src code is included. Give it a look and let me know what addition info you need.
    http://www.genuitec.com/support-mobione/viewtopic.php?f=14&t=1858

    We plan to provide more list automation and manipulation apis in the future, e.g., connect to data sources, position UI to a specific list-item, add/remove items by index, …

    #318683 Reply

    SonamGyato
    Member

    Been playing with this custom list app.

    When one clicks on a list-item and transitions to the landing page,
    how do i know which item was selected.

    Ideally, like to intercept the click – find out what entry was pressed and
    then pass some other string to the landing page.

    #318684 Reply

    SonamGyato
    Member

    Ok…i see what you did.

    you hard-coded the HREF in the custom file.

    i modified it to call my on function()

    list.append(
    ‘<li id=”m1-list-listItem1″ class=”‘ + cssClassList + ‘” href=”javascript:onListSelect(‘ + i + ‘)”>’+
    ‘ <img id=”m1-list-accessoryImage1″ src=”res/images/tableRowDisclosureIndicator.png”/>’ +
    ‘ <div id=”m1-list-text2″ class=”m1-text”>Item-‘ + i + ‘</div>’);

    function onListSelect( item )
    {
    //alert( item );

    phoneui.gotoPage( “#m1-landing”, phoneui.transitions.slideLeft );
    }

    minor problem…the selected row stays hi-lighted.

    how do i turn the hi-light off.

    #318699 Reply

    SonamGyato
    Member

    the problem is when you stay on the page – if you
    navigate away it’s not a huge issue

    function onListSelect( item )
    {
    alert( item );
    }

    this causes the problem.

    #318737 Reply

    support-michael
    Keymaster

    @everest

    >minor problem…the selected row stays hi-lighted.

    I believe the issue is that on iOS devices a selected list-item remains selected during the transition away to a new page and then momentarily when user transitions back to the page with the selected list-item. I’m discussing with dev team now.

    Can you describe how your custom list is meant to work and what effect or feature you would like. For example, do you want the list-item to select on momentarily while mouse-down or other effect?

    #318889 Reply

    SonamGyato
    Member

    i’m trying to size the scrollwindow correctly based on the
    number of list-items created dynamically.

    your sample code Panel with 1 child – a list
    which in turn had 2 children – a header and a listitem.

    i looked at your code

    var listHt = 44 * (+itemCnt+1) + 30;

    i assume that height of the listitems are 44. how did you
    figure that out – because in the gui it’s set to automatic
    or is that the default.

    i assume the itemCnt + 1 is to account for the header.

    even though the header height looks to be more than that
    of the listitem.

    what’s the 30 for???

    #318905 Reply

    support-michael
    Keymaster

    @everest
    > i assume that height of the listitems are 44. how did you figure that out?

    I sort of did a hack to find it. I grabbed one of the list items and barely extended its height by what looked like 1 px to me. When I released it the properties showed the height at 45 so I picked 44. Also I think I know this value from digging in deeper a long time ago but I forgot it (need one of those LIMITLESS movie pills).

    > i assume the itemCnt + 1 is to account for the header.

    Correct. I did not try to precisely fit the list into its containing panel. The 30px is just a number I picked that looked OK for the example purposes.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: Adding a new list-item dynamically – part 2

You must be logged in to post in the forum log in