Input values
Input values
atnoz
Posts: 5Questions: 1Answers: 0
Im will try be more clear. Im really novice.
How can i get the updated value from inputs after change it?
http://live.datatables.net/vogarad/1/edit
Thanks
MM
$(document).ready(function(){
var dataSet = [
["A", 1, 2, 3, 4, '<input type="text" id="in1" name="in1" value=50 "/>', '<input type="checkbox" id="ck1" name="ck1" checked="checked" />'],
["B", 5, 6, 7, 8, '<input type="text" id="in2" name="in2" value=10 "/>', '<input type="checkbox" id="ck2" name="ck2" checked="checked" />'],
["C", 1, 3, 6, 8, '<input type="text" id="in3" name="in3" value=5 "/>', '<input type="checkbox" id="ck3" name="ck3" checked="checked" />']
];
$('#place').html('<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>');
var oTable = $('#example').dataTable({
"data": dataSet,
"columns": [
{ "title": "TYPE" },
{ "title": "C1" },
{ "title": "C2" },
{ "title": "C3" },
{ "title": "C4" },
{ "title": "C5" },
{ "title": "YES" }
]
});
$("#dump").click( function(){
var ckdata = $('input:checked', oTable.fnGetData() );
console.log(ckdata);
});
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Using the old API - as you are, you can use the
$
method:oTable.$('#in1').val()
Allan
Cool! I changed the code. Its now updating the text inputs and geting the values
BUT the checkbox inputs state dont update and im getting empty elements in array. :(
[""][""][""][""][""]["50"]["on"] -> Should be ["A"]["1"]["2"]["3"]["4"]["50"]["on"]
[""][""][""][""][""]["10"]["on"]
[""][""][""][""][""]["5"]["on"]
When it was :
All inputs dont updated, got this ugly tag and not only the values.
["A", 1, 2, 3, 4, "<input type="text" id="in1" name="in1" value=50 "/>", "<input type="checkbox" id="ck1" name="ck1" checked="checked" />"]
Im pulling my hairs (giggles).
We'd need a link to a test case showing the problem please.
Allan
Here Allan:
http://live.datatables.net/vogarad/3/edit
Dump 1 and 2 buttons. Check the console please.
Feel free to modify.
I spent all day playing around but still dont found a full solution.
Anyone testing?
Here you go, not pretty but it works. Check
Dump1
http://live.datatables.net/vogarad/4/edit
God... I see now. One inside other...
Thank you very much. I really appreciated.