Not able to assign or read value from collapsed input field textbox/combo in responsive Datatables

Not able to assign or read value from collapsed input field textbox/combo in responsive Datatables

kalpesh2804kalpesh2804 Posts: 10Questions: 3Answers: 1

But when datatable collapses and when column containing total textbox is no longer visible then value does not get assigned to total textbox. How do I fix this?

I tried to text box using below code.

strRow is Row ID.

// JavaScript Code to Read Value. Its working fine if Textbox visible and not collapsed.
// Radio Button
var rbcc = document.querySelector('input[id="rbcc' + strRow + '"]:checked').value;

// TextBox
var amt = document.getElementById("txtAmt" + strRow).value;

//2nd Method

amt = document.forms[0]["txtAmt" + strRow].value;

// 3rd Method

amt = $('#txtAmt' + strRow).val();

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @kalpesh2804 ,

    The problem is because you're trying to access that column from the DOM - but it's no longer there as it's been responsively hidden.

    If you access that column through the API, the column() would still be available.

    We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. 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

This discussion has been closed.