Title: pivotgrid : styling and i18n
Post by: fguibert 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 : $('#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 : [ { "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" } ]
Title: Re: pivotgrid : styling and i18n
Post by: fguibert on November 11, 2020, 10:58:49 PM
up : someone can help please ? thx
Title: Re: pivotgrid : styling and i18n
Post by: jarry 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 $('#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' } } })
|