如何解决未捕获的TypeError:$ .jqx.pivot不是构造函数错误

时间:2019-04-24 12:02:19

标签: jqxwidgets

这是代码

var source =
            {
                localdata: data,
                datatype: "array",
                datafields:
                [
                    { name: 'firstname', type: 'string' },
                    { name: 'lastname', type: 'string' },
                    { name: 'productname', type: 'string' },
                    { name: 'quantity', type: 'number' },
                    { name: 'price', type: 'number' },
                    { name: 'total', type: 'number' }
                ]
            };
            var dataAdapter = new $.jqx.dataAdapter(source);
            dataAdapter.dataBind();
            // create a pivot adapter from the dataAdapter
            var pivotAdapter = new $.jqx.pivot(
                dataAdapter,
                {
                    pivotValuesOnRows: false,
                    totals: {rows: {subtotals: true, grandtotals: true}, columns: {subtotals: false, grandtotals: true}},
                    rows: [{ dataField: 'firstname' }, { dataField: 'lastname'}],
                    columns: [{ dataField: 'productname' }],
                    values: [
                        { dataField: 'price', 'function': 'sum', text: 'sum', width: NamedNodeMap, formatSettings: { prefix: '$', decimalPlaces: 2 } },
                        { dataField: 'price', 'function': 'count', text: 'count' },
                        { dataField: 'price', 'function': 'average', text: 'average', formatSettings: { prefix: '$', decimalPlaces: 2} }
                    ]
                });

0 个答案:

没有答案