Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2364

How to pass the 'row' parameter from a render function to an external function?

$
0
0

Hi, I can't figure out how to do this simple thing after a long time searching.

I have a render function within a column.
In that function I create an input element, and within that element I define an onclick function.
In that onclick function I want to pass the row parameter (so that I can read/modify that particular row).

Render function:

render: function (data, type, row, meta) {                                    
            return '<input id="userState" type="checkbox" class="toggle" onclick="userState('+ row +')" checked>';
}

And then the onclick function:

function estadoUsuario(userRow) {
    userRow['state'].data("Inactive");                         // I want to modify a column here from that row
    anotherFunction( userRow['id'].data() );                   // I want to pass the data inside a column here
}

In that onclick function I want to:

1) Modify the data in the 'state' column,
2) Pass the data in the 'id' column to another function

I'm getting syntax errors/unexpected identifiers errors because for sure I'm not writing it properly

Thanks a lot in advance


Viewing all articles
Browse latest Browse all 2364

Trending Articles