EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: pkopsidas on July 14, 2016, 11:45:57 PM



Title: negative values and generally symbols in pivotgrid
Post by: pkopsidas on July 14, 2016, 11:45:57 PM
Hello i started using pivotgrid for a project but i don't seem to find how to pass negative values in the cells or symbols like ($, €). Can anyone help me cause it is a bit tricky to use but has features i want


Title: Re: negative values and generally symbols in pivotgrid
Post by: jarry on July 16, 2016, 01:09:12 AM
Please define a 'formatter' function for the value fields to custom the value format.
Code:
pivot:{
    rows:['Country','Category'],
    columns:['Color'],
    values:[
        {field:'Price',op:'sum'},
        {field:'Discount',op:'sum',
            formatter:function(value,row){
                return '$'+value;
            }
        }
    ]
}