How to get value of Input field in a datatable that is populated dynamically?
How to get value of Input field in a datatable that is populated dynamically?
AsthaM
Posts: 2Questions: 1Answers: 0
I am using Datatables with my angular application. This is how I am populating my table:
<tr *ngFor="let row of final_data; let i = index">
<td>{{row.name}}</td>
<td>{{row.id}}</td>
<td>{{row.age}}</td>
<td>{{row.phone}}</td>
<td>{{row.address}}</td>
<td><input id="newfield" [name]=i type="text" placeholder="Enter Goal"></td>
</tr>
Even when I use jQuery to get value by Name, I am only able to catch the first row and not the rest of the rows.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
How are you doing this?
Are you using
row().data()
?You can use
rows().data()
to get multiple rows.Kevin
I am using SerializeArray:
var tbl = $('#mytable').DataTable();
var params = tbl.$('input').serializeArray();
Able to get the data now!
I have the same problem some solution?
Hi @CrissLagla ,
This issue was resolved - did you check Kevin's solution? If this is still an issue for you, 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