facebook

Select List data from json file : CLOSED

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

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

    I’ve created a page and manage to get data to the select list from a JSON file, but when I enter the page I cannot see the value chosen unless I click the list. (See pic1 and pic2) Everything else works fine but I’ve not been able to solve this small issue – any help would be appreciated.

    The problem is for both “Category” and “Customer type”, but the code below is only for the “Category” field.

    This is my code from the search_custom.js.

    function addCatItem(){
    var jsonstr = window.localStorage.getItem(‘data03’);
    obj_data = JSON.parse(jsonstr);

    var numofrec = obj_data.root.length;
    var i = 0;

    while(numofrec > [i]){

    if(window.localStorage.getItem(‘cat’) == (obj_data.root[i].category.id))
    {
    newOpt = ‘<option value=”‘+(obj_data.root[i].category.id)+
    ‘” label=”‘+(obj_data.root[i].category.cat_name) +
    ‘” selected=””>’+(obj_data.root[i].category.cat_name)+'</option>’;
    $(‘#m1-search-hidden-select-cat’).append(newOpt);
    //alert(newOpt)
    }
    else
    {
    newOpt = ‘<option value=”‘+(obj_data.root[i].category.id)+
    ‘” label=”‘+(obj_data.root[i].category.cat_name) +
    ‘”>’+(obj_data.root[i].category.cat_name)+'</option>’;
    $(‘#m1-search-hidden-select-cat’).append(newOpt);
    }
    i++;
    }
    }

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

    Hi TKT,

    What Mobione version are you using?
    If 2.5, please share what cordova version and if you are testing on Web Simulator or Test Center.
    When and where do you call your addCatItem function?

    #343119

    Hi octavio

    I’m using Mobione 2.3.2 (hotfix 1) I have not update cordova so it must be version 2.2

    #343204

    Hi TKT,

    I didn’t realize that we already have provided an example that demonstrate how to add items to a Select List Menu:
    https://www.genuitec.com/support-genuitec/viewtopic.php?p=14030#p14030

    Let me know how it goes for you.

    #344832

    Problem solved!

    #344842

    Hi again – just forget it – I’ve solved the problem 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Select List data from json file : CLOSED

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