How to retrieve datatable row and display in an modal dialog for edit












0















I have a datatable, i want to be able display dialog for edit with the corresponding row values using Jquery or any other means, i have tried the code below, i have done a few researches online, yet no luck, i will appreciate if anyone could give a guide, assist or suggest on how to achieve this



My Table:



<pre> <table id="tblAppointment" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Matric/RegNo</th>
<th>Patient's Name</th>
<th>Visit Date</th>
<th>Appointment Date</th>
<th>Reason(s)</th>
<th>Action</th>
</tr>
</thead>
<tbody>

@foreach (var item in Model)
{
<tr>
<td class="hidden-xs">
@item.MatricRegNo
</td>
<td class="hidden-xs">
@item.PatientName
</td>
<td class="hidden-xs">
@item.EntryDate
</td>
<td class="hidden-xs">
@item.AppointmentDate
</td>
<td class="hidden-xs">
@item.Reasons
</td>
<td>

<span class="btn btn-info btn-sm edit" style="cursor:pointer;" data-toggle="modal" data-target="#modal-Edit"></span>
</td>
</tr>
}
</tbody>




My Modal Dialog:



<div class="modal fade" id="modal-Edit">
<div class="modal-dialog">
<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>
<h4 class="modal-title">Edit Appointments</h4>
</div>
@using (Html.BeginForm())
{
<div class="modal-body">

<div class="form-horizontal">
<div class="form-group" style="display:none;">
<label id="lblAppointmentIdEdit" class="control-label col-md-2">AppointmentId:</label>
<div class="col-md-10">
<input type="text" value="" id="AppointmentIdEdit" name="AppointmentIdEdit" class="form-control appointmentIdEdit" />
</div>
</div>

<div class="form-group">
<label id="lblPatientRegNoEdit" class="control-label col-md-2">RegNo:</label>
<div class="col-md-10">
<input type="text" value="" id="patientRegNoEdit" name="patientRegNoEdit" class="form-control patientRegNoEdit" />

</div>
</div>

<div class="form-group">
<label id="appointmentDateEdit" class="control-label col-md-2">Date:</label>
<div class="col-md-10">
<div class='input-group date' id='datetimepickerEdit'>
<input type='text' class="form-control datetimepickerEdit" id="appointmentDateEdit" name="appointmentDateEdit" value="" />
<span class="input-group-addon datetimepicker-addonEdit">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>

<div class="form-group">
<label id="lblReasonsEdit" class="control-label col-md-2">Reason(s):</label>
<div class="col-md-10">
<textarea rows="4" cols="50" id="reasonsEdit" name="reasonsEdit" class="form-control reasonsEdit"></textarea>
</div>
</div>

</div>

</div>
}
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
<button type="submit" id="UpdateButton" name="UpdateButton" class="btn btn-primary update">Update</button>
</div>
</div>

</div>

</div>


Jquery Function:



<script type="text/javascript">
$('.edit').on('click', function () {
var myModal = $('#modal-Edit');
var AppointmentIdEdit = $(this).closest('tr').find('td.AppointmentIdEdit').html();
var matricRegNo = $(this).closest('tr').find('td.MatricRegNo').html();
var appointmentDate = $(this).closest('tr').find('td.AppointmentDate').html();
var reasons = $(this).closest('tr').find('td.Reasons').html();

$('.appointmentIdEdit', myModal).val(AppointmentIdEdit);
$('.matricRegNoEdit', myModal).val(matricRegNo);
$('.datetimepickerEdit', myModal).val(appointmentDate);
$('.reasonsEdit', myModal).val(reasons);
myModal.modal({ show: true });
return false;
});











share|improve this question



























    0















    I have a datatable, i want to be able display dialog for edit with the corresponding row values using Jquery or any other means, i have tried the code below, i have done a few researches online, yet no luck, i will appreciate if anyone could give a guide, assist or suggest on how to achieve this



    My Table:



    <pre> <table id="tblAppointment" class="table table-striped table-bordered" style="width:100%">
    <thead>
    <tr>
    <th>Matric/RegNo</th>
    <th>Patient's Name</th>
    <th>Visit Date</th>
    <th>Appointment Date</th>
    <th>Reason(s)</th>
    <th>Action</th>
    </tr>
    </thead>
    <tbody>

    @foreach (var item in Model)
    {
    <tr>
    <td class="hidden-xs">
    @item.MatricRegNo
    </td>
    <td class="hidden-xs">
    @item.PatientName
    </td>
    <td class="hidden-xs">
    @item.EntryDate
    </td>
    <td class="hidden-xs">
    @item.AppointmentDate
    </td>
    <td class="hidden-xs">
    @item.Reasons
    </td>
    <td>

    <span class="btn btn-info btn-sm edit" style="cursor:pointer;" data-toggle="modal" data-target="#modal-Edit"></span>
    </td>
    </tr>
    }
    </tbody>




    My Modal Dialog:



    <div class="modal fade" id="modal-Edit">
    <div class="modal-dialog">
    <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>
    <h4 class="modal-title">Edit Appointments</h4>
    </div>
    @using (Html.BeginForm())
    {
    <div class="modal-body">

    <div class="form-horizontal">
    <div class="form-group" style="display:none;">
    <label id="lblAppointmentIdEdit" class="control-label col-md-2">AppointmentId:</label>
    <div class="col-md-10">
    <input type="text" value="" id="AppointmentIdEdit" name="AppointmentIdEdit" class="form-control appointmentIdEdit" />
    </div>
    </div>

    <div class="form-group">
    <label id="lblPatientRegNoEdit" class="control-label col-md-2">RegNo:</label>
    <div class="col-md-10">
    <input type="text" value="" id="patientRegNoEdit" name="patientRegNoEdit" class="form-control patientRegNoEdit" />

    </div>
    </div>

    <div class="form-group">
    <label id="appointmentDateEdit" class="control-label col-md-2">Date:</label>
    <div class="col-md-10">
    <div class='input-group date' id='datetimepickerEdit'>
    <input type='text' class="form-control datetimepickerEdit" id="appointmentDateEdit" name="appointmentDateEdit" value="" />
    <span class="input-group-addon datetimepicker-addonEdit">
    <span class="glyphicon glyphicon-calendar"></span>
    </span>
    </div>
    </div>
    </div>

    <div class="form-group">
    <label id="lblReasonsEdit" class="control-label col-md-2">Reason(s):</label>
    <div class="col-md-10">
    <textarea rows="4" cols="50" id="reasonsEdit" name="reasonsEdit" class="form-control reasonsEdit"></textarea>
    </div>
    </div>

    </div>

    </div>
    }
    <div class="modal-footer">
    <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
    <button type="submit" id="UpdateButton" name="UpdateButton" class="btn btn-primary update">Update</button>
    </div>
    </div>

    </div>

    </div>


    Jquery Function:



    <script type="text/javascript">
    $('.edit').on('click', function () {
    var myModal = $('#modal-Edit');
    var AppointmentIdEdit = $(this).closest('tr').find('td.AppointmentIdEdit').html();
    var matricRegNo = $(this).closest('tr').find('td.MatricRegNo').html();
    var appointmentDate = $(this).closest('tr').find('td.AppointmentDate').html();
    var reasons = $(this).closest('tr').find('td.Reasons').html();

    $('.appointmentIdEdit', myModal).val(AppointmentIdEdit);
    $('.matricRegNoEdit', myModal).val(matricRegNo);
    $('.datetimepickerEdit', myModal).val(appointmentDate);
    $('.reasonsEdit', myModal).val(reasons);
    myModal.modal({ show: true });
    return false;
    });











    share|improve this question

























      0












      0








      0








      I have a datatable, i want to be able display dialog for edit with the corresponding row values using Jquery or any other means, i have tried the code below, i have done a few researches online, yet no luck, i will appreciate if anyone could give a guide, assist or suggest on how to achieve this



      My Table:



      <pre> <table id="tblAppointment" class="table table-striped table-bordered" style="width:100%">
      <thead>
      <tr>
      <th>Matric/RegNo</th>
      <th>Patient's Name</th>
      <th>Visit Date</th>
      <th>Appointment Date</th>
      <th>Reason(s)</th>
      <th>Action</th>
      </tr>
      </thead>
      <tbody>

      @foreach (var item in Model)
      {
      <tr>
      <td class="hidden-xs">
      @item.MatricRegNo
      </td>
      <td class="hidden-xs">
      @item.PatientName
      </td>
      <td class="hidden-xs">
      @item.EntryDate
      </td>
      <td class="hidden-xs">
      @item.AppointmentDate
      </td>
      <td class="hidden-xs">
      @item.Reasons
      </td>
      <td>

      <span class="btn btn-info btn-sm edit" style="cursor:pointer;" data-toggle="modal" data-target="#modal-Edit"></span>
      </td>
      </tr>
      }
      </tbody>




      My Modal Dialog:



      <div class="modal fade" id="modal-Edit">
      <div class="modal-dialog">
      <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>
      <h4 class="modal-title">Edit Appointments</h4>
      </div>
      @using (Html.BeginForm())
      {
      <div class="modal-body">

      <div class="form-horizontal">
      <div class="form-group" style="display:none;">
      <label id="lblAppointmentIdEdit" class="control-label col-md-2">AppointmentId:</label>
      <div class="col-md-10">
      <input type="text" value="" id="AppointmentIdEdit" name="AppointmentIdEdit" class="form-control appointmentIdEdit" />
      </div>
      </div>

      <div class="form-group">
      <label id="lblPatientRegNoEdit" class="control-label col-md-2">RegNo:</label>
      <div class="col-md-10">
      <input type="text" value="" id="patientRegNoEdit" name="patientRegNoEdit" class="form-control patientRegNoEdit" />

      </div>
      </div>

      <div class="form-group">
      <label id="appointmentDateEdit" class="control-label col-md-2">Date:</label>
      <div class="col-md-10">
      <div class='input-group date' id='datetimepickerEdit'>
      <input type='text' class="form-control datetimepickerEdit" id="appointmentDateEdit" name="appointmentDateEdit" value="" />
      <span class="input-group-addon datetimepicker-addonEdit">
      <span class="glyphicon glyphicon-calendar"></span>
      </span>
      </div>
      </div>
      </div>

      <div class="form-group">
      <label id="lblReasonsEdit" class="control-label col-md-2">Reason(s):</label>
      <div class="col-md-10">
      <textarea rows="4" cols="50" id="reasonsEdit" name="reasonsEdit" class="form-control reasonsEdit"></textarea>
      </div>
      </div>

      </div>

      </div>
      }
      <div class="modal-footer">
      <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
      <button type="submit" id="UpdateButton" name="UpdateButton" class="btn btn-primary update">Update</button>
      </div>
      </div>

      </div>

      </div>


      Jquery Function:



      <script type="text/javascript">
      $('.edit').on('click', function () {
      var myModal = $('#modal-Edit');
      var AppointmentIdEdit = $(this).closest('tr').find('td.AppointmentIdEdit').html();
      var matricRegNo = $(this).closest('tr').find('td.MatricRegNo').html();
      var appointmentDate = $(this).closest('tr').find('td.AppointmentDate').html();
      var reasons = $(this).closest('tr').find('td.Reasons').html();

      $('.appointmentIdEdit', myModal).val(AppointmentIdEdit);
      $('.matricRegNoEdit', myModal).val(matricRegNo);
      $('.datetimepickerEdit', myModal).val(appointmentDate);
      $('.reasonsEdit', myModal).val(reasons);
      myModal.modal({ show: true });
      return false;
      });











      share|improve this question














      I have a datatable, i want to be able display dialog for edit with the corresponding row values using Jquery or any other means, i have tried the code below, i have done a few researches online, yet no luck, i will appreciate if anyone could give a guide, assist or suggest on how to achieve this



      My Table:



      <pre> <table id="tblAppointment" class="table table-striped table-bordered" style="width:100%">
      <thead>
      <tr>
      <th>Matric/RegNo</th>
      <th>Patient's Name</th>
      <th>Visit Date</th>
      <th>Appointment Date</th>
      <th>Reason(s)</th>
      <th>Action</th>
      </tr>
      </thead>
      <tbody>

      @foreach (var item in Model)
      {
      <tr>
      <td class="hidden-xs">
      @item.MatricRegNo
      </td>
      <td class="hidden-xs">
      @item.PatientName
      </td>
      <td class="hidden-xs">
      @item.EntryDate
      </td>
      <td class="hidden-xs">
      @item.AppointmentDate
      </td>
      <td class="hidden-xs">
      @item.Reasons
      </td>
      <td>

      <span class="btn btn-info btn-sm edit" style="cursor:pointer;" data-toggle="modal" data-target="#modal-Edit"></span>
      </td>
      </tr>
      }
      </tbody>




      My Modal Dialog:



      <div class="modal fade" id="modal-Edit">
      <div class="modal-dialog">
      <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>
      <h4 class="modal-title">Edit Appointments</h4>
      </div>
      @using (Html.BeginForm())
      {
      <div class="modal-body">

      <div class="form-horizontal">
      <div class="form-group" style="display:none;">
      <label id="lblAppointmentIdEdit" class="control-label col-md-2">AppointmentId:</label>
      <div class="col-md-10">
      <input type="text" value="" id="AppointmentIdEdit" name="AppointmentIdEdit" class="form-control appointmentIdEdit" />
      </div>
      </div>

      <div class="form-group">
      <label id="lblPatientRegNoEdit" class="control-label col-md-2">RegNo:</label>
      <div class="col-md-10">
      <input type="text" value="" id="patientRegNoEdit" name="patientRegNoEdit" class="form-control patientRegNoEdit" />

      </div>
      </div>

      <div class="form-group">
      <label id="appointmentDateEdit" class="control-label col-md-2">Date:</label>
      <div class="col-md-10">
      <div class='input-group date' id='datetimepickerEdit'>
      <input type='text' class="form-control datetimepickerEdit" id="appointmentDateEdit" name="appointmentDateEdit" value="" />
      <span class="input-group-addon datetimepicker-addonEdit">
      <span class="glyphicon glyphicon-calendar"></span>
      </span>
      </div>
      </div>
      </div>

      <div class="form-group">
      <label id="lblReasonsEdit" class="control-label col-md-2">Reason(s):</label>
      <div class="col-md-10">
      <textarea rows="4" cols="50" id="reasonsEdit" name="reasonsEdit" class="form-control reasonsEdit"></textarea>
      </div>
      </div>

      </div>

      </div>
      }
      <div class="modal-footer">
      <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
      <button type="submit" id="UpdateButton" name="UpdateButton" class="btn btn-primary update">Update</button>
      </div>
      </div>

      </div>

      </div>


      Jquery Function:



      <script type="text/javascript">
      $('.edit').on('click', function () {
      var myModal = $('#modal-Edit');
      var AppointmentIdEdit = $(this).closest('tr').find('td.AppointmentIdEdit').html();
      var matricRegNo = $(this).closest('tr').find('td.MatricRegNo').html();
      var appointmentDate = $(this).closest('tr').find('td.AppointmentDate').html();
      var reasons = $(this).closest('tr').find('td.Reasons').html();

      $('.appointmentIdEdit', myModal).val(AppointmentIdEdit);
      $('.matricRegNoEdit', myModal).val(matricRegNo);
      $('.datetimepickerEdit', myModal).val(appointmentDate);
      $('.reasonsEdit', myModal).val(reasons);
      myModal.modal({ show: true });
      return false;
      });








      jquery html ajax datatable






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 16:47









      UwakPeterUwakPeter

      1031214




      1031214
























          2 Answers
          2






          active

          oldest

          votes


















          0














          make a javascript function and on click get all the values that you need to display on modal.
          different methods you can apply on this.
          using .val(), .attr() you can get the value and append on the modal using javascript.






          share|improve this answer
























          • Can you show an example, or a link to where i can read it up?

            – UwakPeter
            Nov 15 '18 at 7:38



















          0














          I was able to resolve using the Jquery function below:



          <script type="text/javascript">
          $(document).ready(function () {

          $(".edit[data-target='#modal-Edit']").click(function () {
          var columnHeadings = $("thead th").map(function () {
          return $(this).text();
          }).get();
          columnHeadings.pop();
          var columnValues = $(this).parent().siblings().map(function () {
          return $(this).text();
          }).get();
          var myModal = $('#modal-Edit');
          $('#AppointmentIdEdit', myModal).val(columnValues[0].trim());
          $('#patientRegNoEdit', myModal).val(columnValues[1].trim());
          $('.appointmentDateEdit', myModal).val(columnValues[4].trim());
          $('#reasonsEdit', myModal).val(columnValues[5].trim());
          //console.log("Column Values: " + columnValues[5]);

          myModal.modal({ show: true });
          return false;
          });
          $('.modal-footer .update').click(function () {
          $('form[name="modalForm"]').submit();
          });
          });







          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285794%2fhow-to-retrieve-datatable-row-and-display-in-an-modal-dialog-for-edit%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            make a javascript function and on click get all the values that you need to display on modal.
            different methods you can apply on this.
            using .val(), .attr() you can get the value and append on the modal using javascript.






            share|improve this answer
























            • Can you show an example, or a link to where i can read it up?

              – UwakPeter
              Nov 15 '18 at 7:38
















            0














            make a javascript function and on click get all the values that you need to display on modal.
            different methods you can apply on this.
            using .val(), .attr() you can get the value and append on the modal using javascript.






            share|improve this answer
























            • Can you show an example, or a link to where i can read it up?

              – UwakPeter
              Nov 15 '18 at 7:38














            0












            0








            0







            make a javascript function and on click get all the values that you need to display on modal.
            different methods you can apply on this.
            using .val(), .attr() you can get the value and append on the modal using javascript.






            share|improve this answer













            make a javascript function and on click get all the values that you need to display on modal.
            different methods you can apply on this.
            using .val(), .attr() you can get the value and append on the modal using javascript.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 13 '18 at 17:02









            Ijaz AliIjaz Ali

            162




            162













            • Can you show an example, or a link to where i can read it up?

              – UwakPeter
              Nov 15 '18 at 7:38



















            • Can you show an example, or a link to where i can read it up?

              – UwakPeter
              Nov 15 '18 at 7:38

















            Can you show an example, or a link to where i can read it up?

            – UwakPeter
            Nov 15 '18 at 7:38





            Can you show an example, or a link to where i can read it up?

            – UwakPeter
            Nov 15 '18 at 7:38













            0














            I was able to resolve using the Jquery function below:



            <script type="text/javascript">
            $(document).ready(function () {

            $(".edit[data-target='#modal-Edit']").click(function () {
            var columnHeadings = $("thead th").map(function () {
            return $(this).text();
            }).get();
            columnHeadings.pop();
            var columnValues = $(this).parent().siblings().map(function () {
            return $(this).text();
            }).get();
            var myModal = $('#modal-Edit');
            $('#AppointmentIdEdit', myModal).val(columnValues[0].trim());
            $('#patientRegNoEdit', myModal).val(columnValues[1].trim());
            $('.appointmentDateEdit', myModal).val(columnValues[4].trim());
            $('#reasonsEdit', myModal).val(columnValues[5].trim());
            //console.log("Column Values: " + columnValues[5]);

            myModal.modal({ show: true });
            return false;
            });
            $('.modal-footer .update').click(function () {
            $('form[name="modalForm"]').submit();
            });
            });







            share|improve this answer




























              0














              I was able to resolve using the Jquery function below:



              <script type="text/javascript">
              $(document).ready(function () {

              $(".edit[data-target='#modal-Edit']").click(function () {
              var columnHeadings = $("thead th").map(function () {
              return $(this).text();
              }).get();
              columnHeadings.pop();
              var columnValues = $(this).parent().siblings().map(function () {
              return $(this).text();
              }).get();
              var myModal = $('#modal-Edit');
              $('#AppointmentIdEdit', myModal).val(columnValues[0].trim());
              $('#patientRegNoEdit', myModal).val(columnValues[1].trim());
              $('.appointmentDateEdit', myModal).val(columnValues[4].trim());
              $('#reasonsEdit', myModal).val(columnValues[5].trim());
              //console.log("Column Values: " + columnValues[5]);

              myModal.modal({ show: true });
              return false;
              });
              $('.modal-footer .update').click(function () {
              $('form[name="modalForm"]').submit();
              });
              });







              share|improve this answer


























                0












                0








                0







                I was able to resolve using the Jquery function below:



                <script type="text/javascript">
                $(document).ready(function () {

                $(".edit[data-target='#modal-Edit']").click(function () {
                var columnHeadings = $("thead th").map(function () {
                return $(this).text();
                }).get();
                columnHeadings.pop();
                var columnValues = $(this).parent().siblings().map(function () {
                return $(this).text();
                }).get();
                var myModal = $('#modal-Edit');
                $('#AppointmentIdEdit', myModal).val(columnValues[0].trim());
                $('#patientRegNoEdit', myModal).val(columnValues[1].trim());
                $('.appointmentDateEdit', myModal).val(columnValues[4].trim());
                $('#reasonsEdit', myModal).val(columnValues[5].trim());
                //console.log("Column Values: " + columnValues[5]);

                myModal.modal({ show: true });
                return false;
                });
                $('.modal-footer .update').click(function () {
                $('form[name="modalForm"]').submit();
                });
                });







                share|improve this answer













                I was able to resolve using the Jquery function below:



                <script type="text/javascript">
                $(document).ready(function () {

                $(".edit[data-target='#modal-Edit']").click(function () {
                var columnHeadings = $("thead th").map(function () {
                return $(this).text();
                }).get();
                columnHeadings.pop();
                var columnValues = $(this).parent().siblings().map(function () {
                return $(this).text();
                }).get();
                var myModal = $('#modal-Edit');
                $('#AppointmentIdEdit', myModal).val(columnValues[0].trim());
                $('#patientRegNoEdit', myModal).val(columnValues[1].trim());
                $('.appointmentDateEdit', myModal).val(columnValues[4].trim());
                $('#reasonsEdit', myModal).val(columnValues[5].trim());
                //console.log("Column Values: " + columnValues[5]);

                myModal.modal({ show: true });
                return false;
                });
                $('.modal-footer .update').click(function () {
                $('form[name="modalForm"]').submit();
                });
                });








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 16 '18 at 10:48









                UwakPeterUwakPeter

                1031214




                1031214






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285794%2fhow-to-retrieve-datatable-row-and-display-in-an-modal-dialog-for-edit%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine