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'>&times;</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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -