jQWidgets Forums

jQuery UI Widgets Forums Grid Cant get aggregates to work..

This topic contains 3 replies, has 2 voices, and was last updated by  shiva112 12 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Cant get aggregates to work.. #15690

    shiva112
    Member

    I cant get the aggregates to work… what am i doing wrong here?

    $("#"+tabran).jqxGrid(
    {
    width: 1000,
    height:500,
    showfilterrow: true,
    filterable: true,
    groupable: true,
    columnsresize: true,
    columnsreorder: true,
    editable: true,
    showaggregates: true,
    showstatusbar: true,
    statusbarheight: 50,
    selectionmode: 'singlecell',
    source: source,
    theme: theme,
    columns: [
    { text: 'Voornaam', datafield: 'fname', width: 100, aggregates: ['count']},
    { text: 'Achternaam', datafield: 'lname', width: 250, aggregates: ['count'] },
    { text: 'Telefoon', datafield: 'tel', width: 100, aggregates: ['count'] },
    { text: 'Email', datafield: 'email', width: 120, aggregates: ['count'] },
    { text: 'Contact Persoon', datafield: 'cp', width: 100, aggregates: ['count'] },
    { text: 'Bevoegd Aanvrager', datafield: 'ba', width: 100, aggregates: ['count'] },
    { text: 'Taal', datafield: 'lang', width: 50, aggregates: ['count'] },
    ]
    });
    Cant get aggregates to work.. #15694

    Peter Stoev
    Keymaster

    Hi shiva112,

    The Grid is expected to be bound to an instance of jqxDataAdapter, not to a source object.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Cant get aggregates to work.. #15696

    shiva112
    Member

    I have

    var dataAdapter = new $.jqx.dataAdapter(source);

    Isnt that enough?

    here is all my code:

    <?php $tabran = $timestamp = (microtime(1) * 100); ?>
    <script type="text/javascript">
    $(document).ready(function () {
    var theme = getDemoTheme();
    var tabran = '<?php echo $tabran; ?>';
    var source =
    {
    datatype: "json",
    datafields: [
    { name: 'contactid'},
    { name: 'fname'},
    { name: 'lname'},
    { name: 'tel'},
    { name: 'email'},
    { name: 'cp', type: 'number'},
    { name: 'ba', type: 'number'},
    { name: 'lang'},
    ],
    url: 'sql/s1.php',
    cache: false,
    updaterow: function (rowid, rowdata, commit) {
    // synchronize with the server - send update command
    commit(true);
    }
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $("#"+tabran).jqxGrid(
    {
    width: 1000,
    height:500,
    showfilterrow: true,
    filterable: true,
    groupable: true,
    columnsresize: true,
    columnsreorder: true,
    editable: true,
    showaggregates: true,
    showstatusbar: true,
    statusbarheight: 50,
    selectionmode: 'singlecell',
    showtoolbar: 'true',
    source: source,
    theme: theme,
    columns: [
    { text: 'Voornaam', datafield: 'fname', width: 100, aggregates: ['count']},
    { text: 'Achternaam', datafield: 'lname', width: 250, aggregates: ['count'] },
    { text: 'Telefoon', datafield: 'tel', width: 100, aggregates: ['count'] },
    { text: 'Email', datafield: 'email', width: 120, aggregates: ['count'] },
    { text: 'Contact Persoon', datafield: 'cp', width: 100, aggregates: ['count'] },
    { text: 'Bevoegd Aanvrager', datafield: 'ba', width: 100, aggregates: ['count'] },
    { text: 'Taal', datafield: 'lang', width: 50, aggregates: ['count'] },
    ]
    });
    $("#excelExport").jqxButton({ theme: theme });
    $("#xmlExport").jqxButton({ theme: theme });
    $("#csvExport").jqxButton({ theme: theme });
    $("#tsvExport").jqxButton({ theme: theme });
    $("#htmlExport").jqxButton({ theme: theme });
    $("#jsonExport").jqxButton({ theme: theme });
    // var exportInfo;
    //$("#excelExport").click(function () {
    // exportInfo = $("#"+tabran).jqxGrid('exportdata', 'xls');
    // document.write (exportInfo);
    // });
    $("#excelExport").click(function () {
    $("#"+tabran).jqxGrid('exportdata', 'xls', 'jqxGrid');
    });
    $("#xmlExport").click(function () {
    $("#"+tabran).jqxGrid('exportdata', 'xml', 'jqxGrid');
    });
    $("#csvExport").click(function () {
    $("#"+tabran).jqxGrid('exportdata', 'csv', 'jqxGrid');
    });
    $("#tsvExport").click(function () {
    $("#"+tabran).jqxGrid('exportdata', 'tsv', 'jqxGrid');
    });
    $("#htmlExport").click(function () {
    $("#"+tabran).jqxGrid('exportdata', 'html', 'jqxGrid');
    });
    $("#jsonExport").click(function () {
    $("#"+tabran).jqxGrid('exportdata', 'json', 'jqxGrid');
    });
    });
    </script>
    <?php echo '<div id='. $tabran .'></div>' ?>
    <div style='margin-top: 20px;'>
    <div style='float: left;'>
    <input type="button" value="Export to Excel" id='excelExport' />
    <br /><br />
    <input type="button" value="Export to XML" id='xmlExport' />
    </div>
    <div style='margin-left: 10px; float: left;'>
    <input type="button" value="Export to CSV" id='csvExport' />
    <br /><br />
    <input type="button" value="Export to TSV" id='tsvExport' />
    </div>
    <div style='margin-left: 10px; float: left;'>
    <input type="button" value="Export to HTML" id='htmlExport' />
    <br /><br />
    <input type="button" value="Export to JSON" id='jsonExport' />
    </div>
    </div>
    <script> //prints the value of x </script>

    kind Regards

    Shiva

    Cant get aggregates to work.. #15697

    shiva112
    Member

    i got it working!!!
    Thanks!! you really are great!!!

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

You must be logged in to reply to this topic.