Bootstrap Datatable populate through AJAX from Partial view where Parent child checkbox to select/unselect is not working -
hi trying implement bootstrap datatable populate through ajax in partial view parent child checkbox select/unselect item level unable that.
controller
[httppost] public actionresult lobstoredetailscall(string loboption,string actualstartdate,string actualenddate,string typedescription) { typebo obj = new typebo(); wmmodel.viewmodel.warrantytypevm objtype = new wmmodel.viewmodel.warrantytypevm(); objtype.actualstartdate = convert.todatetime(actualstartdate); objtype.actualenddate = convert.todatetime(actualenddate); objtype.typedescription= typedescription; objtype.loboptions = loboption; return partialview("storeslist", obj.getloblistofstores(objtype)); } main view:
<div class="dvlststoreoptions"> <div class="col-md-4"> @html.radiobutton("rdnstoreoptions", 1, false)<span>dks stores</span> </div> <div class="col-md-4"> @html.radiobutton("rdnstoreoptions", 2, false)<span>f&s stores</span> </div> <div class="col-md-4"> @html.radiobutton("rdnstoreoptions", 3, false)<span>golf galaxy stores</span> </div> <div class="col-md-4"> <input type="button" id="btnstoretype" value=" go " /> </div> @html.partial("storeslist", model)
partial view:
@model wmmodel.viewmodel.warrantytypevm <table id="plantable" class="table table-striped table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th>@html.checkbox("chkparent", false, new { id = "chkparentitem" }) select all</th> <th>lobname</th> <th>storenumber </th> <th>storelocation</th> </tr> </thead> <tbody> @if (model.lstlobwithstores != null) { foreach (var item in model.lstlobwithstores) { <tr> <td>@html.checkbox("chkchildstore@(item.lsid)", false, new { id = "chkchildstore@(item.lsid)", value = "@item.lsid", @class = "check-all-child" }) </td> <td>@item.lobname</td> <td>@item.storenumber</td> <td>@item.storelocation</td> </tr> } } </tbody> </table> jquery in partial view
$(document).ready(function () { $('#plantable').datatable({ scrolly: 300, "sort": false, "searching": false }); $('#btnstoretype').click(function (event) { if ($('input:radio:checked').length > 0) { var passdata = { loboption: $("input[name='rdnstoreoptions']:checked").val(), actualstartdate: $('txtactualstartdate').val(), actualenddate: $('txtactualenddate').val(), typedescription: $('txtwarrantydesc').val() }; $.ajax({ type: 'post', contenttype: "application/json; charset=utf-8", datatype: 'html', url: '/warrantytype/lobstoredetailscall', data: json.stringify(passdata), success: function (data) { $("#dvlststoredetails").html(data);
$(".dvlststoreoptions").show(); // $(".dvlststoredetails").show(); $('#plantable').show(); }, error: function () { $("#lblmsg").html("it not removed successfully.") } }); } }); now data table generataing ajax. cannot select parent/child checkbox in main page. when check view main page source. datatable items not showing.
how can complete parent child checkbox select/un-select options.
anyone can provide lead or have faced issue.
Comments
Post a Comment