facebook

Single selection list item change programmatically

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

    KariSolamaki
    Member

    I have search this board how to programmatically (javascript function in *_custom.js) change selection in (single selection) list, but not have figured out how to do that.
    List has items itemNro0, itemNro1, itemNro2, itemNro3, itemNro4…
    My page is Page1 and list is listTable and item ID (which should be selected instead of an other) is itemNro3.
    I have tried so many different approaches that now I’m totally stuck…

    Any help will gratefully received,

    best regards, ET

    #345217 Reply

    Brandon
    Member
    #345241 Reply

    KariSolamaki
    Member

    @CincyPlanet wrote:

    See if this post helps you:
    http://www.genuitec.com/support-genuitec/viewtopic.php?p=8909#p8909

    Thanks, but can’t get it work.
    These I can understand, but how to select the specific item and no others?:

    //to select all
    function selectAll() {
        $('#m1-Page1-listTable > li').each(function () {
        $(this).addClass(m1Design.css("selected"));
        });
    }
    
    // to deselect all
    function selectNone() {
        $('#m1-Page1-listTable > li').each(function () {
        $(this).removeClass(m1Design.css("selected"));
        });
    }
    #345243 Reply

    KariSolamaki
    Member

    Also an other topic about lists.
    How to disable selection of a specific list item or how to hide specific item from list?

    Thank you in advance, ET

    #345280 Reply

    @Einotes Team wrote:

    @CincyPlanet wrote:

    See if this post helps you:
    http://www.genuitec.com/support-genuitec/viewtopic.php?p=8909#p8909

    Thanks, but can’t get it work.
    These I can understand, but how to select the specific item and no others?:
    Following the example that CincyPlanet shared, you only need to specify in the itemToSelect var the indexes of values that you want to select, example:

    var itemsToSelect = [0, 1, 2];

    Let me know if you need further assistance.

    #345288 Reply

    KariSolamaki
    Member

    Thank you, Octavio, well done!

    Got the selection change to work!

    function resetListTable() {
    // Note: m1-Page1-listTable is an ID of <ul> element, taken from TC/Tools/DOM Inspector
        var selListId = 'm1-Page1-listTable';
        var listName = 'listTable';
        var itemsToSelect = [0];
        var selId = $('#' + selListId + '> li').each(
        function (i) { $(this)[i == itemsToSelect ? 'addClass' : 'removeClass'](m1Design.css("selected")); });
    // This line updates hidden select, for the case the whole design will be used as a form
        phoneui.preprocessDOM('#' + selListId);
    }

    But what about the question:

    How to disable selection of a specific list item or how to hide specific item from list?

    This works to whole list when added into button On Click $(‘#m1-Page1-listTable’).slideToggle(500);
    but how to temporarily hide (or prevent selection) listitems i.e. itemNro3 and itemNro4.
    I have search the solution but maybe the problem is with my brain cells not the list cells… 😉
    My test Page1.mobi attached.

    Ok, no big problem any more.
    Somehow for list item this $(‘#m1-Page1-itemNro3’).slideToggle(500); did not work before, but now it works!
    Question: How to point list item with indexnumber?
    Something like this $(‘#m1-Page1-listTable[3]’).slideToggle(500);

    Attachments:
    You must be logged in to view attached files.
    #345324 Reply

    Hi,

    Please try something like:

    $('#m1-page1-listTable').children()[index]
    #345327 Reply

    KariSolamaki
    Member

    @support-octavio wrote:

    Hi,
    Please try something like:

    $('#m1-page1-listTable').children()[index]

    Thank you Octavio, but I could not get it work as like this:
    $(‘#m1-Page1-listTable’).children()[3].hide(0);
    No problem, I can point the items with id…

    Soon I have my first app ready to test as native ipa in my iPhone,
    as I understood that phase doesn’t need payment made to Apple?
    And compiling into ipa is included inMobiOne license fee?

    #345353 Reply

    Hi ET,

    >as I understood that phase doesn’t need payment made to Apple?
    >And compiling into ipa is included inMobiOne license fee?
    You need to be enrolled in the iOS Developer program, which has a cost of $99/year. To learn more about building native iOS apps see this section on learning center: http://www.genuitec.com/mobile/section.php?id=3

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Single selection list item change programmatically

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