How to render progress bar with data from 2 Columns

How to render progress bar with data from 2 Columns

support@kosmos.desupport@kosmos.de Posts: 16Questions: 7Answers: 0
edited May 2022 in DataTables 1.10

Hello,

i have added a progressbar to my table.
But iI haven been able to set the Max valu to the "betrag" valu, the value in column 1.
how can I achive this?

columns: [
        { data: "name" },
        { data: "betrag", render: $.fn.dataTable.render.number( '.', ',', 0, '€' ) },
        { data: "prognose" ,            
          render: function (data, type, row, meta) {
                return type === 'display'
                   ? '<progress value="' + data + '" max= "' + row[1]+'"></progress>'
                    : 100;
           },},
    ], 

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736
    Answer ✓

    row[1]

    This is used with array data. You are using objects so you need to use row.betrag instead.

    Kevin

  • support@kosmos.desupport@kosmos.de Posts: 16Questions: 7Answers: 0

    is there a way to change the color to red?

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736
    edited May 2022

    This tutorial shows techniques to style the HTML5 progress bar. Also take a look at the CSS tab of this example.

    Kevin

Sign In or Register to comment.