Search code examples
javascriptjqueryasp.net-mvckendo-gridjquery-dialog

Kendo Grid inside Jquery Dialog with modal Issue


I have a kendo grid control inside jquery dialog. It works fine except when in dialog modal is true, I am not able to work on grid filter. If dialog modal is false, it works perfectly. It is must for me to apply modal true kind of functionality.

Here is the snapshot of issue:

enter image description here

Jquery Dialog code:

$('#dialog').dialog({
  title: 'Add Patient',
  height: 'auto',
  width: '95%',
  position: ['top', 70],
  draggable: false,
  show: 'blind',
  hide: 'blind',
  modal: true,
  resizable: false,
  open: function (event, ui) {
    var url='@Url.Action("AddPatient", "PatientManagement")';
    $(this).load(url);
  },
  close: function (event, ui) {
    $(this).html('');
  }
});

Kendo grid:

@(Html.Kendo().Grid<RxConnectEntities.Patient>().Name("PatientList")
  .Columns(columns =>
  {
    columns.Bound(p => p.PatientID).Visible(false);
    columns.Bound(p => p.LastName).Width(100);
    columns.Bound(p => p.FirstName).Width(100);
    columns.Bound(p => p.Gender).Width(80);
    columns.Bound(p => p.DateOfBirth).Width(90).Format("{0:MM/dd/yyyy}").EditorTemplateName("DateOfBirth");
    columns.Bound(p => p.PhoneNumber).Title("Phone Number").Width(110);
    columns.Command(command =>
    {
      command.Custom("Edit").Text("Edit").Click("EditGrid");
    }).Width(120);
  })
  .Filterable(f=>f.Enabled(true))
  .Pageable(p => p.PageSizes(true))
  .Scrollable()
  .Sortable()
  .Groupable()
  .DataSource(dataSource => dataSource
  .Ajax().ServerOperation(false)
  .PageSize(5)
  .Model(m => m.Id(p => p.PatientID))
  .Read(read => read.Action("GetPatientList", "PatientManagement"))
  .Destroy(delete => delete.Action("Deletepatient", "PatientManagement"))
))

Solution

  • Use KendoWindow will solve your problem. Example :

    $('#dialog').kendoWindow({
      title: 'Add Patient',
      height: 'auto',
      width: '95%',
      position: ['top', 70],
      draggable: false,
      show: 'blind',
      hide: 'blind',
      modal: true,
      resizable: false,
      open: function (event, ui) {
        var url='@Url.Action("AddPatient", "PatientManagement")';
        $(this).load(url);
      },
      close: function (event, ui) {
        $(this).html('');
      }
    });