jQWidgets Forums

jQuery UI Widgets Forums Grid Problem with aggregates

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Problem with aggregates #24154

    natecbarrett
    Member

    Hello,

    I have a grid, that loads data in from an external data source, using json. the grid uses an aggregate on the revenue column.
    The grid looks like this:

     $("#jqxgrid").jqxGrid(
    {
    width: 670,
    source: dataAdapter,
    autoheight: true,
    showstatusbar: true,
    statusbarheight: 50,
    showaggregates: true,
    altrows: true,
    enabletooltips: true,
    columns: [
    { text: 'System', datafield: 'system' },
    { text: 'Revenue', datafield: 'revenue', cellsformat: 'C', aggregates: ['sum'] },
    ]
    });

    I then refresh the data in the grid using a date filter from a datetime picker like so:

    $("#jqxButton").on('click', function () {
    var selection = $("#date").jqxDateTimeInput('getRange');
    if (selection.from != null)
    {
    var data = { "start_date": selection.from.toLocaleDateString(), "end_date": selection.to.toLocaleDateString()};
    source.data = data;
    source2.data = data;
    $("#jqxgrid").jqxGrid({ source: source, showaggregates: true });
    $("#jqxgrid2").jqxGrid({ source: source2 });
    var dataAdapterChart = new $.jqx.dataAdapter(source);
    $('#jqxChart').jqxChart({ source: dataAdapterChart });
    var dataAdapterChart2 = new $.jqx.dataAdapter(source2);
    $('#jqxChart2').jqxChart({ source: dataAdapterChart2 });
    }
    });

    However,
    When i do so, the aggregate data goes away and does not display. What can I do to fix this?

    Problem with aggregates #24155

    Peter Stoev
    Keymaster

    Hi,

    It is not possible to update the Grid’s dataAdapter by using the source.data = data; syntax. You can set the Grid’s source property only to a new jqxDataAdapter plug-in instance. According to me, the issue is that.

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.