row().add & column render()

row().add & column render()

hnhegdehnhegde Posts: 67Questions: 17Answers: 0

Hello,
I have a column that is rendered thus:

{
    data: "size",
    render: function (d, t, row) {                        
        return row.width + 'x' + row.height;
    }
 },

When I add a row with row.add(), how should I set the value for 'size' column? Following is an attempt that doesn't work:

table.row.add({
    ........
    ........
    size: function() {
        return width + 'x' + height;
    }
)}

Kindly advise,

Regards,
Harsha

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 6,954Questions: 22Answers: 1,510
    edited August 5 Answer ✓

    Looks like you have an object based data structure that includes width and height in each row, something like this?

    {
      .....
      size: x,
      width: y,
      height: z
    }
    

    I think what you want is something more like this:

    table.row.add({
        ........
        ........
        size: x,
        width: y,
        height: z
    
    )}
    

    If this doesn't help then please post an example of the raw data for a row and your full Datatables init code.

    Kevin

  • hnhegdehnhegde Posts: 67Questions: 17Answers: 0

    That worked! Thanks @kthorngren !

Sign In or Register to comment.