#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    4
    Rep Power
    0

    JavaScript : Dashcode dashboard Widget - list datasource


    Hi

    I am having problems populating a list from a datasource and or adding to the items.

    i added a list to the view.
    i changed Data type from static to dynamic
    i gave it datasource name"listdatasource"

    now in the load i tried this
    listdatasource._rowData.push("New Item 4");

    that didnt work
    i tried using a datasource, so
    $.each(json.data, function(i, entry) {
    listDataSource._rowData.push(entry.name);

    that didnt work either


    at the end of the load i have
    document.getElementById("list").object.reloadData();

    and this is the implimentation

    // This object implements the dataSource methods for the list.
    var listDataSource = {

    // Sample data for the content of the list.
    // Your application may also fetch this data remotely via XMLHttpRequest.
    _rowData: [],

    // The List calls this method to find out how many rows should be in the list.
    numberOfRows: function() {
    return this._rowData.length;
    },

    // The List calls this method once for every row.
    prepareRow: function(rowElement, rowIndex, templateElements) {
    // templateElements contains references to all elements that have an id in the template row.
    // Ex: set the value of an element with id="label".
    if (templateElements.rowLabel) {
    templateElements.rowLabel.innerText = this._rowData[rowIndex].title.$t;

    }

    // Assign a click event handler for the row.
    rowElement.onclick = function(event) {
    // Do something interesting
    //alert("Row "+rowIndex);
    // document.getElementById("box").innerText=listDataSource._rowData[rowIndex].cont ent.$t;
    };
    }


    };



    what am i doing wrong?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    4
    Rep Power
    0

    resolved


    its been resolved
    thanks
    Last edited by borg239; August 16th, 2013 at 10:11 AM. Reason: resolved

IMN logo majestic logo threadwatch logo seochat tools logo