While rendering columns from Ajax resp, access entire data object not justproperty

While rendering columns from Ajax resp, access entire data object not justproperty

pjtfpjtf Posts: 1Questions: 1Answers: 0
edited June 2023 in Free community support

Hi guys,

Can you guide me a little bit.
I use ajax sourced data with custom rendering.
My ajax response contains a list of objects. I can access each property using its name. What I'm looking for, is a way to access whole object not just single property per column. For instance, say there's a property 'surname' and the other 'visible', surname should only be rendered if visible is true. So contents of single column depends on two properties of a object.

'columns': [
            {
                "data": "id",
                "render": function(data, type, row, meta) {
                    return "<a class='' href='/plik/" + data + "'><i class='icon ion-navicon-round'/></a>";
                }
            },
        ]

In this example I use "id" property of source object and it works fine
but I would like to access like while data that represents my object and than it's properties like data.id etc.

Is it possible?
br
pj

Answers

  • allanallan Posts: 61,732Questions: 1Answers: 10,110 Site admin

    The row parameter that is passed into the function is the full data object for the row. row.id would get you the id property for the row.

    Allan

Sign In or Register to comment.