Set value in specific cell in specific row
Set value in specific cell in specific row
Hi,
Simple question, given a row and a column, I want to set that cell's value. It seems simple according to the docs but I can't get it to work. Here's my table:
emailCasesTbl = $j('#emailCases').DataTable({
pageLength: 25,
columns: [
{data: 'Id', visible: false, searchable: false, orderable: false, name: 'id'},
{data: null, visible:true, searchable: false, orderable: false, defaultContent: '', name: 'openlink'},
{data: 'Number_of_Hours_in_Queue__c', visible: true, searchable: true, orderable: false, defaultContent: ''},
{data: 'CaseNumber', visible: true, searchable: true, orderable: false, defaultContent: '', name: 'caseNo'},
{data: 'Subject', visible: true, searchable: true, orderable: false, defaultContent: ''},
{data: 'Status', visible: true, searchable: true, orderable: false, defaultContent: ''},
{data: 'Origin', visible: true, searchable: true, orderable: false, defaultContent: ''},
{data: 'Account.Name', visible: true, searchable: true, orderable: false, defaultContent: ''},
{data: 'GCSS_Contact__r.Name', visible: true, searchable: true, orderable: false, defaultContent: ''},
{data: 'Owner.Name', visible: true, searchable: true, orderable: false, defaultContent: ''},
{data: 'CreatedDate', visible: true, searchable: true, orderable: false, defaultContent: '',
render: function(data, type, row) {
return (moment(data).tz("{!userTimezone}").format('L, LT'));
}
},
{data: 'Queue_Time__c', visible: true, searchable: true, orderable: false, defaultContent: '',
render: function(data, type, row) {
return (moment(data).tz("{!userTimezone}").format('L, LT'));
}
}
],
rowId: 'Id'
});
And here's my function. I want to select the top row in the table, and select the column with name "openlink" so I can inject data into it.
function addLinkToEmailCasesTbl(){
if(emailCasesTbl){
emailCasesTbl.cell(0, 'openlink:name').data('test').draw();
}
}
But it doesn't work. I get no errors, but no changes either. As far as I understand it, the cell function call I'm making should be selecting the top row, 0, and the column with the name 'openlink', then it should set the value of the cell to 'test' and display it, but its not happening. Can anyone see what I'm doing wrong?
Thanks
Steven
Answers
To add: If I add this:
then inspect "test", it shows an object from a seemingly random row