Skip to content

Commit b428420

Browse files
committed
add event to customize cleaning of cell values
Exemple of usage : ``` $('table.highchart') .on('highchartTable.cleanValue', function(value, options) { if (options.indexTr == 0) { options.value = options.value.replace(/\$/, ''); } }) .highchartTable() ``` List of options passed to the event : * value (that's the one that must be changed, contains the value already cleaned by HighchartTable) * rawValue : the value not cleaned by HighchartTable * td : jQuery objet of the td were the valued is extracted from * tr : jQuery objet of the tr where is td is readed from * indexTr : index of the tr (starts at 0) * indexTd : index of the td (starts at 1)
1 parent 3456a13 commit b428420

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

jquery.highchartTable.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,16 @@
222222
}
223223
} else {
224224
var cleanedCellValue = rawCellValue.replace(/\s/g, '').replace(/,/, '.');
225-
cellValue = Math.round(parseFloat(cleanedCellValue) * column.scale * 100) / 100;
225+
var eventOptions = {
226+
value: cleanedCellValue,
227+
rawValue: rawCellValue,
228+
td: $td,
229+
tr: $(row),
230+
indexTd: indexTd,
231+
indexTr: indexRow
232+
}
233+
$table.trigger('highchartTable.cleanValue', eventOptions);
234+
cellValue = Math.round(parseFloat(eventOptions.value) * column.scale * 100) / 100;
226235

227236
var dataGraphX = $td.data('graph-x');
228237

0 commit comments

Comments
 (0)