table.row(this).data(); is returning undefined
table.row(this).data(); is returning undefined
manideep1234
Posts: 2Questions: 1Answers: 0
the code used is as follows:
let addUPCGrid = function() {
let rowData;
var data = jQuery.map(dofUPCDetailsResponseJson.resultSet, function(el, i) {
return [
[el.upc_number, el.model, el.item_number, el.crc, el.rms_dept, el.regular_cost, el.regular_sell, el.created_by, el.creation_date, el.modified_by, el.modified_date, el.upc_id, el.upc_status, el.upc_comment, el.new_cost, el.flat_dollar_amount, el.vendor_support_dollar, el.vendor_support_percentage]
];
});
table = $('#upc_grid').DataTable({
data: data,
order: [
[12, "desc"]
],
"columnDefs": [{
"targets": [11],
"visible": false,
"searchable": false
}],
"createdRow": function(row, data, dataIndex) {
if (data[12] == "Invalid") {
// $('td', row).css('background-color', '#af1e2d');
$('td', row).css('color', '#af1e2d');
validUPCGridValue = false;
}
},
select: true,
'scrollX': true
});
$('#upc_grid tbody').on('click', 'tr', function() {
rowData = table.row(this).data();
if (rowData != "undefined" && !($(this).hasClass('selected'))) {
updateUPCBtn.disabled = false;
deleteUPCBtn.disabled = false;
} else {
updateUPCBtn.disabled = true;
deleteUPCBtn.disabled = true;
}
upcNumber.value = rowData[0];
model.innerHTML = rowData[1];
itemNumber.innerHTML = rowData[2];
crc.innerHTML = rowData[3];
newCost.value = rowData[14];
vendorSupportPercent.value = rowData[17];
flatDollarAmount.value = rowData[15];
rmsDept.innerHTML = rowData[4];
regularCost.value = rowData[5];
regularSell.value = rowData[6];
itemLevelComments.value = rowData[13];
vendorSupportDollar.value = rowData[16];
selectedUPCID = rowData[11];
});
}
I kind of checked the forums and tried multiple solutions but no luck, Please help me in this.
Thanks in advance.
Manideep
This discussion has been closed.
Answers
I am able to see the data table but the issue is that table.row(this).data(); is giving undefined, any suggestions..
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin