reference udf column from table click

reference udf column from table click

crcucbcrcucb Posts: 72Questions: 23Answers: 0

I have a user defined column (UpdateFamiliars) that I would like to capture the click even for and read the value that was set via the render.

{ data: null ,
        name: 'UpdateFamiliars',
                    title: 'Update Familiar', // The name of your calculated column
                    render: function (data, type, row) {
                        familiarUrl = 'set';
                        if ( data.view_ResidentFamiliarUserNames.FamiliarUserNames == null) {
                            familiarUrl =  'Set';
                        } else {


                           if ( data.view_ResidentFamiliarUserNames.FamiliarUserNames.indexOf(userSession.UserFullName) !=-1  ) {
                                  familiarUrl =  'Unset';
                               } else {
                                   familiarUrl =  'Set';
                               };
                           };
                            var retv ='<a id="familiarHref" title="Click to ' + familiarUrl + ' yourself as a familiar" href="#" onclick="return false;">' +  familiarUrl +'</a>';
                            return retv;
                        }  // render: function (data, type, row) {

below is the click event where I am trying to figure out how to read the contents of UpdateFamiliar
table.on('click', 'tbody tr td:nth-child(12)', function (e) {
//console.log('f 1');
event.preventDefault();

        let rowdata = table.row(e.target.closest('tr')).data();

    alert('Res=' + rowdata.Residents.ResidentAID + '   User= ' + userSession.UserAID + '   =' +  rowdata.UpdateFamiliars );


  }); //  table.on('click', 'td.editor-edit button', function (e) {

Answers

  • kthorngrenkthorngren Posts: 22,237Questions: 26Answers: 5,115

    Sounds like you are going to need to use cell().render() to get the rendered data for that cell.

    Kevin

Sign In or Register to comment.