jQWidgets Forums

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Update gauges via ajax Update gauges via ajax #70741

    fcovas
    Participant

    Dimitar,

    After checking some of the answers on the forum, I am sure the problem is not on my server-side.
    I think the problem is that I’m not using a dataAdapter to perform the update of the gauges values.

    Below is a sample of the JSON returned from the server. This gets updated after every server-call, but the gauges does not get updated.

    {“LeadershipScore”:”2.81″,”OverallScore”:”2.86″,”ThoughtScore”:”2.84″,”EngagementScore”:”2.85″,”ClimateScore”:”2.82″,”RelationshipScore”:”3″}

    Below is how I interact with the server through ajax and update the gauges.

    $.ajax(
    {
    type: ‘POST’,
    url: ‘<%= Url.Action(“updateGauges”,”workforcevelocityfactors”)%>’,
    dataType: ‘json’,
    cache: false,
    async: true,
    data: {fromDate: fromDate,toDate: toDate, department:department},
    success: function (data)
    {

    $(‘#gaugeContainerLeadership’).jqxGauge(‘setValue’, data.LeadershipScore);

    $(‘#gaugeContainerClimate’).jqxGauge(‘setValue’, data.ClimateScore);

    $(‘#gaugeContainerWorkplace’).jqxGauge(‘setValue’, data.RelationshipScore);

    $(‘#gaugeContainerSpeed’).jqxGauge(‘setValue’, data.ThoughtScore);

    $(‘#gaugeContainerEngagement’).jqxGauge(‘setValue’, data.EngagementScore);

    $(‘#gaugeContainerOverall’).jqxGauge(‘setValue’, data.OverallScore);

    }
    });

    Dimitar, what am I missing?
    How do I incorporated the ajax call above with the dataAdapter?
    I think that lack of a dataAdapter is what’s causing the problem.

    Thank you!

    in reply to: Update gauges via ajax Update gauges via ajax #70251

    fcovas
    Participant

    Ok,

    One more finding. The gauges are updating, but using the values returned by the server on the “previous” ajax call ….

    in reply to: Update gauges via ajax Update gauges via ajax #70246

    fcovas
    Participant

    $.ajax(
    {
    type: ‘POST’,
    url: ‘’,
    dataType: ‘json’,
    cache: false,
    async: true,
    data: {fromDate: fromDate,toDate: toDate, department:department},
    success: function (data)
    {

    $(‘#gaugeContainerLeadership’).jqxGauge(‘setValue’, data.LeadershipScore);

    }
    }

    After every different success call, “data.LeadershipScore” contains different data. If I put an alert box and print it I can see the data is different. I can also see the data through Chrome’s debugging…

    So, for some reason, $(‘#gaugeContainerLeadership’).jqxGauge(‘setValue’, data.LeadershipScore) does not change the gauge’s value. It maintains the previous value. However, the first time I change a value in the dropdown box, the gauge value gets updated. After the first time, the gauge stops getting update, even though different data are being sent from the server.

    in reply to: Update gauges via ajax Update gauges via ajax #70245

    fcovas
    Participant

    Hello Dimitar,

    The Ajax call’s success is made when an option within a dropdown box is changed.

    So, when the dropdown box has a different item selected, the following event below is triggered:

    $(‘#dropdownbox’).change(function() {
    $.ajax(
    {
    type: ‘POST’,
    url: ‘’,
    dataType: ‘json’,
    cache: false,
    async: true,
    data: {fromDate: fromDate,toDate: toDate, department:department},
    success: function (data)
    {

    $(‘#gaugeContainerLeadership’).jqxGauge(‘setValue’, data.LeadershipScore);

    }
    }

    If a debug the success function above every time an item is changed in the dropdown, I see new data coming from the server based on the selection made in the dropdown. However, the gauge above (the one that needs to be updated with the new data), does not get its value changed.

    I just updated the jQWidgets to version (3.7.1)

    Best Regards,
    Fabiano

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