facebook

list-db-example; custom icons per listitem

💡
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 1 post (of 1 total)
  • Author
    Posts
  • #348597 Reply

    Maia
    Member

    Hi, I have been playing with the list-db-example. Thank you very much for submitting this, saved me hours of work.
    While going through the code of the Mobionelistbuilder.js, it would appear to me that it is possible to let each list-item have a unique icon. I think this should be able to work by adding more data to the bindingmap, but cannot get this to work.

    codesnippet I am looking at:

    build : function (listId, dataSrc, bindingMap, cssPrefix, headerTxt, footerTxt) {

    //image widget
    else if (ele.hasClass(cssPrefix + ‘image’) ) {
    ele.attr(‘src’,data);
    }

    }

    In the UpdateListscreen function I added :
    for (i=0; i < len; i++) {
    var newItem = {
    ‘id’: results.rows.item(i).id,
    ‘item’: results.rows.item(i).Name,
    ‘image’: results.rows.item(i).Icon};
    items.push(newItem);
    }

    I am guessing I should do something here, with the bindingmap:

    In the function Buildnewlist
    function buildNewList(listname,items) {
    var header = items.length ? “Items: ” + items.length : “Database is empty”;
    var bindingMap = [
    //provide access to the single property, ‘item’
    //{dataProvider: function(dataObj){return dataObj.item},
    //widgetProvider: function(domCtx) {return $(‘[id$=_item]’, domCtx)}

    {dataProvider: function(dataObj) {return dataObj.item; },
    widgetProvider: function(domCtx) {return $(‘[id$=_item]’, domCtx); } },
    //textarea>textarea widget
    {dataProvider: function(dataObj) {return dataObj.image; },
    widgetProvider: function(domCtx) {return $(‘[id$=_iconItem]’, domCtx); } }
    ];

    ListBuilder.build(listname,items, bindingMap, ‘m1-‘,header,”);
    }

    Is my assumption true, and if so, could you help me in the right direction or provide an example ?
    Much appreciated

Viewing 1 post (of 1 total)
Reply To: list-db-example; custom icons per listitem

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