jQWidgets Forums

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts

  • phpmaven
    Participant

    As a follow up, I can’t access dataAdapter.records[] object outside of the dataAdapter definition:

    ***************************

    var dataAdapter = new $.jqx.dataAdapter(source, {
    loadComplete: function () {
    // this shows an object
    alert(dataAdapter.records[0]);
    },
    formatData: function (data) {
    $.extend(data, {
    userId: current_user
    });
    return data;
    },
    loadError: function(xhr, status, error)
    {
    alert(error);
    }
    }
    );
    //this shows undefined
    alert(dataAdapter.records[0]);


    phpmaven
    Participant

    Thank you, but that doesn’t give me what I need. If I try and create a variable from the returned records, it will tell me it’s undefined outside of the scope of the dataAdapter functions. For example if I try the following code and then try to use the “test” variable outside of the dataAdapter, it tells me it’s undefined. The “test” var should be global, but I can’t access it outside the function.

    Mark

    *******************************

    var test;
    var dataAdapter = new $.jqx.dataAdapter(source, {
    loadComplete: function () {
    test = dataAdapter.records[0];
    },
    formatData: function (data) {
    $.extend(data, {
    userId: current_user
    });
    return data;
    },
    loadError: function(xhr, status, error)
    {
    alert(error);
    }
    });

    // get undefined error here
    alert(test);

Viewing 2 posts - 1 through 2 (of 2 total)