1"use strict";(globalThis.webpackChunkrekalogika_docs=globalThis.webpackChunkrekalogika_docs||[]).push([[1149],{3969:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>c});const i=JSON.parse('{"id":"pivot-table/rendering","title":"Rendering a Pivot Table","description":"Rendering a pivot table is done by an instance of TableVisitor. The framework","source":"@site/docs/pivot-table/03-rendering.md","sourceDirName":"pivot-table","slug":"/pivot-table/rendering","permalink":"/pivot-table/rendering","draft":false,"unlisted":false,"editUrl":"https://github.com/rekalogika/rekalogika-docs/edit/main/docs/pivot-table/03-rendering.md","tags":[],"version":"current","sidebarPosition":3,"frontMatter":{"title":"Rendering a Pivot Table"},"sidebar":"docs","previous":{"title":"Usage","permalink":"/pivot-table/usage"},"next":{"title":"Grouping Strategies","permalink":"/pivot-table/grouping"}}');var r=t(4848),o=t(8453);const a={title:"Rendering a Pivot Table"},s=void 0,l={},c=[];function d(e){const n={code:"code",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.p,{children:["Rendering a pivot table is done by an instance of ",(0,r.jsx)(n.code,{children:"TableVisitor"}),". The framework\nprovides a default implementation ",(0,r.jsx)(n.code,{children:"BasicTableRenderer"}),", which renders the pivot\ntable into an HTML string."]}),"\n",(0,r.jsxs)(n.p,{children:["To customize the rendering, the easiest way is to extend the\n",(0,r.jsx)(n.code,{children:"BasicTableRenderer"})," class and override the relevant methods. Usually you will\nwant to override the ",(0,r.jsx)(n.code,{children:"visitContent()"})," method to customize the rendering of any\ncell content."]}),"\n",(0,r.jsx)(n.p,{children:"Example:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-php",children:"use Rekalogika\\PivotTable\\TableRenderer\\BasicTableRenderer;\n\nclass CustomTableRenderer extends BasicTableRenderer\n{\n #[\\Override]\n public function visitContent(mixed $content): string\n {\n if ($content instanceof Country) {\n return $country->getFlagEmoji() . ' ' . htmlspecialchars($country->getName());\n }\n\n return parent::visitContent($content);\n }\n}\n"})})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>s});var i=t(6540);const r={},o=i.createContext(r);function a(e){const n=i.useContext(o);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),i.createElement(o.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.