jquery dynamic input box with datakey field

snortiers

New Member
Hi here i am using jquery datatable for crud operation by creating dynamic input box, for updating i need to get the datakey value for inserting/updating, but not to visible from the front side, so i tried with dynamic hidden field and making that column visible false not able to get that values.What would be the the best way using jquery to achieve this for updating need a datakey value for each row. \[code\] function BindDataTable(srcJsonData) { document.getElementById('dtGrid').style.display = 'block'; document.getElementById('ctl00_ContentPlaceHolder1_btnSave').style.visibility = 'visible'; document.getElementById('ctl00_ContentPlaceHolder1_btnCancel').style.visibility = 'visible'; var src = http://stackoverflow.com/questions/15846948/JSON.parse(srcJsonData); var userid = document.getElementById('ctl00_ContentPlaceHolder1_hdUserId').value; $(document).ready(function() { var oTable = $('#dtGrid').dataTable ({ "bProcessing": true, "bSort": false, "bAutoWidth": true, "bFilter": true, "iDisplayLength": 10, "aaData": src["aaData"], "bDestroy": true, "sPaginationType": "full_numbers", "aoColumnDefs": [ { "aTargets": [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "fnCreatedCell": function(nTd, sData, oData, iRow, iCol) { var b = $('<input type="textbox" class="tableCell" onkeyup="isNumber(this);" style="width:50px" id="' + iRow + '" name="' + iRow + '" value ="' + sData + '"/>'); $(nTd).empty(); $(nTd).prepend(b); } }, { "aTargets": [0, 1, 2], "sClass": "tableLabel" }, { "aTargets": [15], "sClass": "tableHidden", // "fnCreatedCell": function(nTd, sData, oData, iRow, iCol) { // var b = $('<input type="textbox" class="tableHidden" style="width:50px" id="' + iRow + '" name="' + iRow + '" value ="' + sData + '"/>'); // $(nTd).empty(); // $(nTd).prepend(b); // }, "bVisible": true } ] }); }); }\[/code\]here i am retreiving 175 records and have to save that all 175 records, but only the front page of 10 records able to get for saving, i am retreiving it by class name, how i can do this to get all 175 records?\[code\] var data = http://stackoverflow.com/questions/15846948/[]; $("#dtGrid tr").each(function() { var dataObject = new Object(); var i = 0; $(this).find('td').each(function() { if (this.className == "tableLabel") { var lblText = this.innerText; if (i == 0) dataObject.Label1 = lblText; if (i == 1) dataObject.Label2 = lblText; if (i == 2) dataObject.Label3 = lblText; } else if (this.className == "tableCell") { var innerText = $(this).find('.tableCell').val(); if (i == 3) dataObject.Text1 = innerText; if (i == 4) dataObject.Text2 = innerText; if (i == 5) dataObject.Text3 = innerText; if (i == 6) dataObject.Text4 = innerText; if (i == 7) dataObject.Text5 = innerText; if (i == 8) dataObject.Text6 = innerText; if (i == 9) dataObject.Text7 = innerText; if (i == 10) dataObject.Text8 = innerText; if (i == 11) dataObject.Text9 = innerText; if (i == 12) dataObject.Text10 = innerText; if (i == 13) dataObject.Text11 = innerText; if (i == 14) dataObject.Text12 = innerText; } else { var innerHiddenText = $(this).find('.tableHidden').val(); if (i == 15) dataObject.Hidden1 = innerHiddenText; } i++; }); data.push(dataObject); }); saveData(data);\[/code\]
 
Back
Top