Skip to content

Commit ed69112

Browse files
Merge pull request #457 from contactashish13/issue-450
header row configuration
2 parents 14c19b1 + 1cd0af1 commit ed69112

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

classes/Visualizer/Render/Sidebar/Type/DataTable/DataTable.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,38 @@ protected function _renderTableSettings() {
247247

248248
self::_renderGroupStart( esc_html__( 'Row/Cell Settings', 'visualizer' ) );
249249

250+
self::_renderSectionStart( esc_html__( 'Header Row', 'visualizer' ) );
251+
252+
self::_renderSectionDescription( esc_html__( 'These values will be applied once you save the chart.', 'visualizer' ) );
253+
254+
self::_renderColorPickerItem(
255+
esc_html__( 'Background Color', 'visualizer' ),
256+
'customcss[headerRow][background-color]',
257+
isset( $this->customcss['headerRow']['background-color'] ) ? $this->customcss['headerRow']['background-color'] : null,
258+
null
259+
);
260+
261+
self::_renderColorPickerItem(
262+
esc_html__( 'Color', 'visualizer' ),
263+
'customcss[headerRow][color]',
264+
isset( $this->customcss['headerRow']['color'] ) ? $this->customcss['headerRow']['color'] : null,
265+
null
266+
);
267+
268+
self::_renderTextItem(
269+
esc_html__( 'Text Orientation', 'visualizer' ),
270+
'customcss[headerRow][transform]',
271+
isset( $this->customcss['headerRow']['transform'] ) ? $this->customcss['headerRow']['transform'] : null,
272+
esc_html__( 'In degrees.', 'visualizer' ),
273+
'',
274+
'number',
275+
array(
276+
'min' => -180,
277+
'max' => 180,
278+
)
279+
);
280+
self::_renderSectionEnd();
281+
250282
self::_renderSectionStart( esc_html__( 'Odd Table Row', 'visualizer' ) );
251283

252284
self::_renderSectionDescription( esc_html__( 'These values will be applied once you save the chart.', 'visualizer' ) );

js/render-datatables.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@
185185
columns: cols,
186186
stripeClasses: stripe,
187187
} );
188+
189+
// header row is handled here as the class is added dynamically to it (after the table is rendered).
190+
if(typeof chart.settings['cssClassNames'] !== 'undefined'){
191+
if(typeof chart.settings['cssClassNames']['headerRow'] !== 'undefined'){
192+
$('#' + id + ' table thead tr').addClass( chart.settings['cssClassNames']['headerRow'] );
193+
}
194+
}
195+
188196
$('.loader').remove();
189197
}
190198

0 commit comments

Comments
 (0)