Progressbar max value not fixed in advance
Progressbar max value not fixed in advance
Philou
Posts: 24Questions: 4Answers: 0
I did integrate the progress bar in the Datatables. However, the max value is a fix number in my exemple.
This max value should be variable regarding the max value in the column.
Is there a way to calculate first the max value of the column and then render the Datatable using the calculated max value when rendering it ?
{
targets:3,
title:'Progress',
defaultContent:'',
data:'fieldData.Salary',
type:'num',
searchable:true,
visible:true,
orderable:true,
render:function(data, type, row, meta) {return '<progress value="' + data + '"max="150000"type="progressbar" ></progress>';},
},
This question has an accepted answers - jump to answer
Answers
You could access the main data array in the rendering function to calculate the max value, but that would be very inefficient as
render
can be called a four or more times per cell.Depending on how you are loading the data, I would suggest performing the max calculation up front - e.g. if you are using Ajax loaded data use
xhr
and store it in a variable your rendering function can access.Allan
Well I am using Filemaker database and implementing datatables in it.
Like you advise, I calculate the max value before rendering the table, and it works.
Thanks !