javascript - How to generate modal popup of each row creation using datatable js -
i using datatable js in mvc4. want generate modal popup on each row creation when table create data fill , open each modal popup on each radio button click.
$('#hotel').datatable({ bdestroy: true, bprocessing: true, sajaxsource: '@url.action("selecthotel_tripinfo", "cl_invoices")', aocolumndefs: [ { atargets: [0], "mrender": function (data, type, full) { newhotel(full[0]); return "<input id='btnresp' type='radio' class='open-addrespdialog btn btn-primary' data-toggle='modal' data-target='#examplemodal1' data-whatever='' data-id=" + data + ">"; } }], fnserverparams: function (aodata) { aodata.push( { name: "trip_no", value: $("#txttripno").val() } ); } });
my popup function :
function newhotel(i) { var items = ''; items += "<div class='modal fade' id='examplemodal1"+i+"' tabindex='-1' role='dialog' aria-labelledby='examplemodallabel'>"+ "<div class='modal-dialog' role='document'>"+ " <div class='modal-content'>"+ " <div class='modal-header'>"+ " <button type='button' class='close' data-dismiss='modal' aria-label='close'><span aria-hidden='true'>×</span></button>"+ " </div>"+ " <div class='modal-body'>"+ " <form>"+ " <div class='form-group'>"+ " <div class='box-body'>"+ " <div class='row'>"+ " <input name='item2.hi_rm_tariff' class='form-control textdecor abc' type='text' value="+i+"/>"+ " </div>"+ " </div> "+ " </div> "+ " </form>"+ " </div>"+ " </div>"+ " </div>"+ "</div>"; $('#rdata').append(items); items = ''; }
Comments
Post a Comment