jQWidgets Forums

jQuery UI Widgets Forums Grid Problem combining virtual paging and aggregate

Tagged: ,

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

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

  • hardcode
    Member

    Hello
    I have the grid working and i have add the aggregate to sum up values. It all seems good and perfect but the problem is because of the aggregate the virtual paging does not work any more. When i take out the aggregate fields and rendering the virtual paging works good.
    what might be the problem or what am i missing ?
    am using the version 2.5
    below is my code thanks

    var source =
    {
    datatype: "json",
    async:false,
    datafields: [
    { name: 'transactionCode' },
    { name: 'tripNumber' },
    { name: 'transDate'},
    { name: 'details'},
    { name: 'shortage'},
    { name: 'amount'},
    { name: 'payment'},
    { name: 'balance'},
    { name: 'creator'},
    { name: 'product'},
    { name: 'month'}
    ],
    beforeprocessing: function (data) {
    source.totalrecords = data[0].TotalRows;
    },
    id: 'transactionCode',
    url: url,
    root: 'Rows',
    cache: false
    };
    preserveSource = source;
    var dataAdapter = new $.jqx.dataAdapter(source);
    $("#tripGrid").jqxGrid(
    {
    width: '100%',
    autoheight: true,
    source: dataAdapter,
    sortable:true,
    editable: false,
    pageable: true,
    pagesize:20,
    altrows:true,
    pagesizeoptions:['20', '40', '60'],
    selectionmode: 'singlerow',
    columnsresize: true,
    columnsheight:30,
    virtualmode:true,
    theme: theme,
    showstatusbar: true,
    statusbarheight: 60,
    showaggregates: true,
    rendergridrows: function(obj){
    return obj.data
    },
    columns: [
    { text: 'Date', dataField: 'transDate', width: 120},
    { text: 'Details', columntype: 'textbox',dataField: 'details', width: 110},
    { text: 'Salary Month', dataField: 'month', width: 100, columntype: 'textbox'},
    { text: 'Trip Number', dataField: 'tripNumber', width: 110, columntype: 'textbox'},
    { text: 'Product', columntype: 'textbox', dataField: 'product', width: 100},
    { text: 'Shortage', dataField: 'shortage', width: 135, cellsalign: 'right', cellsformat: 'f2', aggregates: ['min', 'max','sum'],
    aggregatesrenderer: function (aggregates) {
    var renderstring = "";
    var name = "";
    $.each(aggregates, function (key, value) {
    if (key == 'min'){
    name = 'Min';
    }else if (key == 'max'){
    name = 'Max';
    }else{
    name = 'Total' }
    renderstring += '<div style="position: relative; margin: 4px; overflow: hidden;"><strong>' + name + ': </strong>' + value +'</div>';
    });
    return renderstring;
    }},
    { text: 'Amount',columntype:'textbox', dataField: 'amount', width: 135,cellsformat: 'f2', cellsalign: 'right',aggregates: ['sum'],aggregatesrenderer:
    function (aggregates) {
    var renderstring = "";
    var name = "";
    $.each(aggregates, function (key, value) {
    if (key == 'sum'){
    name = 'Total Amount';
    }
    renderstring += '<div style="position: relative; margin: 4px; overflow: hidden;"> <strong>' + name + '</strong><br />' + value +'</div>';
    });
    return renderstring;
    }},
    { text: 'Payment', dataField: 'payment', width: 130, cellsalign: 'right', cellsformat: 'f2',aggregates: ['sum'], aggregatesrenderer:
    function (aggregates) {
    var renderstring = "";
    var name = "";
    $.each(aggregates, function (key, value) {
    if (key == 'sum'){
    name = 'Total Payment';
    }
    renderstring += '<div style="position: relative; margin: 4px; overflow: hidden;"><strong>' + name + '</strong><br />' + value +'</div>';
    });
    return renderstring;
    }},
    { text: 'Balance', dataField: 'balance', width: 130, cellsalign: 'right', cellsformat: 'f2',aggregates: ['sum'],
    aggregatesrenderer: function (aggregates) {
    var renderstring = "";
    var name = "";
    $.each(aggregates, function (key, value) {
    if (key == 'sum'){
    name = 'Current Balance';
    }
    renderstring += '<div style="position: relative; margin: 4px; overflow: hidden;"><strong>' + name + '</strong><br />' + value +'</div>';
    });
    return renderstring;
    }},
    { text: 'Employee', dataField: 'creator', width: 138}
    ]
    });
    /*grid ends*/
    }

    Peter Stoev
    Keymaster

    Hi hardcode,

    Thanks for writing.

    Unfortunately, aggregates in virtual mode are not currently supported.

    Best Regards,
    Peer 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.