EasyUI Forum
April 18, 2024, 10:20:46 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: pivotgrid : styling and i18n  (Read 3052 times)
fguibert
Newbie
*
Posts: 23


View Profile
« on: November 02, 2020, 04:30:45 AM »

Hi all

I am testing pivotgrid component, but I am facing some issues and this component is not well documented :
- how to use i18n to set field names and column titles properly ?
- how to style column headers ? (just want to add some links and put background color)
- I want to style some cells with testing values which are not values of the cell, but parts of my json response : how to ? (only row and value parameters available)

thx a lot for your support

code example :

Code:

$('#pg').pivotgrid({
                title:'Synthèse des participations délégataires à vos campagnes',
                url:'${pageContext.request.contextPath}/rest/campagnes/tdb/',
                method:'get',
                pivot:{
                    rows:['relationActive','raisonSocialeDelegataire'],
                    columns:['libelleCampagneMere'],
                    values:[
                        {field:'inclus', op:'sum',   
                            formatter:function(value,row,index){
                           
                            if (value != null) {
                            if (value==1) return "<center><img align='center' title='" + i18n_messages["lib.yes"] + "' src='"+appContext+"/resources/img/ico_ok.png' width='16' height='16'/></center>";
                            if (value==0) return "";
                            if (value>1) return "<center>"+value+"</center>";
                            }
                            return "";
                        }}
                    ]
                },
                       
                 i18n: {
                  columns: ['test1','test2']   
                 },
                frozenColumnTitle:'<span style="font-weight:bold">Mes délégataires / Campagnes</span>',
                valuePrecision:0
                       
            })
        }

example datas :

Code:
[
   {
      "libelleCampagneMere":"ddsdsq",
      "idCampagneMere":31,
      "raisonSocialeDelegataire":"test",
      "relationActive":"Relations Actives",
      "idDelegataire":1241,
      "idCampagneDelegataire":0,
      "score":-1,
      "inclus":0,
      "totalInclus":1,
      "statutCampagneDelegataire":null,
      "statutCampagneDelegant":"Clôturée"
   },
   {
      "libelleCampagneMere":"dsqdsq",
      "idCampagneMere":29,
      "raisonSocialeDelegataire":"test",
      "relationActive":"Relations Actives",
      "idDelegataire":1241,
      "idCampagneDelegataire":0,
      "score":-1,
      "inclus":0,
      "totalInclus":1,
      "statutCampagneDelegataire":null,
      "statutCampagneDelegant":"Clôturée"
   }
]

Logged
fguibert
Newbie
*
Posts: 23


View Profile
« Reply #1 on: November 11, 2020, 10:58:49 PM »

up : someone can help please ?
thx
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #2 on: November 12, 2020, 11:58:07 PM »

Please define the 'headerFormatter' and 'headerStyler' functions to custom the header cells. Make sure to download the newest version from https://www.jeasyui.com/download/v19.php and https://www.jeasyui.com/extension/pivotgrid.php
Code:
$('#pg').pivotgrid({
    //...
    headerFormatter: function(title,col){
        if (title == 'inclus'){
          return 'title<a href="#">link</a>';
        } else {
          return title;
        }
    },
    headerStyler: function(title){
      if (title == 'inclus'){
        return 'background:#ddd'
      }
    }       
})
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!