Author Topic: Filter, grouping and subtotals  (Read 1687 times)

pquser

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 26
    • View Profile
Filter, grouping and subtotals
« on: July 30, 2017, 08:11:19 pm »
Hi,

I have problems understanding the API to implement a filter line above my table and grouping with subtotals.

This is what I have:
Code: [Select]
$(function () {
                        var data_umsatzauswertung = [{"Artikel":"Bier","Artikelgruppe":"Getr\u00e4nke","Menge":"1,00 Stk","Nettopreis":"2,00","Bruttopreis":"2,00","MwSt":"0,00"},{"Artikel":"Radler\/Weizenbier","Artikelgruppe":"Getr\u00e4nke","Menge":"2,00 Stk","Nettopreis":"5,00","Bruttopreis":"5,00","MwSt":"0,00"},{"Artikel":"Wein rot\/weiss","Artikelgruppe":"Getr\u00e4nke","Menge":"1,00 Stk","Nettopreis":"3,00","Bruttopreis":"3,00","MwSt":"0,00"},{"Artikel":"Weinschorle gro\u00df","Artikelgruppe":"Getr\u00e4nke","Menge":"1,00 Stk","Nettopreis":"4,00","Bruttopreis":"4,00","MwSt":"0,00"},{"Artikel":"Apfelschorle gro\u00df","Artikelgruppe":"Getr\u00e4nke","Menge":"1,00 Stk","Nettopreis":"2,00","Bruttopreis":"2,00","MwSt":"0,00"},{"Artikel":"Cola\/Fanta\/Mezzomix","Artikelgruppe":"Getr\u00e4nke","Menge":"1,00 Stk","Nettopreis":"1,50","Bruttopreis":"1,50","MwSt":"0,00"},{"Artikel":"Mineralwasser klein","Artikelgruppe":"Getr\u00e4nke","Menge":"1,00 Stk","Nettopreis":"1,50","Bruttopreis":"1,50","MwSt":"0,00"},{"Artikel":"Mineralwasser gross","Artikelgruppe":"Getr\u00e4nke","Menge":"1,00 Stk","Nettopreis":"2,00","Bruttopreis":"2,00","MwSt":"0,00"},];

                        var obj = {};
                        obj.maxWidth = '100%';
                        obj.height = 'flex';
                        obj.flex =
                            {
                                one: true
                            }
                        obj.dataModel = {
                            dataType: "JSON",
                            data: data_umsatzauswertung                        };
                        $('#grid_json_umsatzauswertung').pqGrid(obj);
                    });

Thank you for any hints in advance.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Filter, grouping and subtotals
« Reply #1 on: July 31, 2017, 05:53:41 pm »
filter row is created with filterModel and column.filter

Code: [Select]
filterModel:{
      on: true,
      header: true
}

Code: [Select]
{
        dataIndx: 'Artikel',
        filter:{
           type:'textbox',
           condition:'begin',
           listeners:['keyup']
        }
},

and grouping is created with groupModel

Code: [Select]
groupModel:{
        on: true,
        dataIndx: ['Artikelgruppe'],
        grandSummary: true
}

jsfiddle: http://jsfiddle.net/ng3L1kpg/2/

Online examples: https://paramquery.com/pro/demos/filter_header_local

https://paramquery.com/pro/demos/group_rows
« Last Edit: July 31, 2017, 05:55:37 pm by paramquery »