Mitchell Y
Mitchell Y

Reputation: 113

How to display content of file in a modal Window in Kendo Grid

I'm having displaying the content of a JSON file in a modal window. Currently i'm only able to display the file name as a link but what I would want to do is to display the content of that file. Any ideas how it is done. Below is my current code.

$("#adhocSearchKendoGrid").on("click", "a.open-modal", function() {
    var dataItem = grid.dataItem($(this).closest("tr"));

    $("<div></div>")
      .appendTo($("#win"))
      .kendoWindow({ 
        title: "Editing item #" + dataItem.filename,
        width: "40%",
        modal: true,
        position: {
          top: 30
        }
        })
      .data("kendoWindow")
            .content("<a target='_blank' class='file-view'>" +dataItem.filename+"</a>");
            //.maximize();
  });

Upvotes: 1

Views: 597

Answers (1)

DontVoteMeDown
DontVoteMeDown

Reputation: 21475

Use jQuery's load() method:

$("<div></div>")
    .appendTo($("#win"))
    .load("path/to/my/file", function() {
        $(this).parent().kendoWindow({ 
             title: "Editing item #" + dataItem.filename,
             width: "40%",
             modal: true,
             position: {
                 top: 30
             }
        }).data("kendoWindow").center();
    });

Upvotes: 1

Related Questions