<tbody data-bind="foreach: arraytoadd"> <tr> <td data-bind="text: employeename"></td> <td><input id="indynamicntendtime" data-bind="text: workedhours"/></td> <td> <input type="button" id="btnsave" value="save"/> </td> </tr> </tbody>
Templatefunction = function() { var self = this; self.employeename = ko.observavle(""); self.workedhours = ko.observale(""); } RealFunciton = function() { ver self = this; self.arrarytoadd = ko.obeservablearray(); self.addevent = function () { self.arraytoadd.push( new Templatefunction); } }
for(var i=0;i<response.d.length;i++)> { var x = new TemplateFunction(); x.employeename(response.d[i].EmployeeName); x.workedhours(response.d[i].ActualContractorEndTime); jobactivityVM.arraytoadd.push(x); } //TO DO SAVE FUNCIONALITY. On every row save button click i have to get the corresponding workhours $(document).on("click", "[id*=btnsave]", function (e) { var x = new TemplateFunction(); var contractorstarttime = Templatefunction["workedhours"]; //HOW TO GET THE CHANGED WORKED HOURS . //start initialising the parameters needed for the ajax call var params = {}; params.workedhours=workedhours; });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)