如何在按钮单击时通过jquery onsucess关闭kendo窗口 [英] How to close kendo window through jquery onsucess on button click

查看:88
本文介绍了如何在按钮单击时通过jquery onsucess关闭kendo窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个附件栏



columns.Command(command => command.Custom(Attachments)。点击(showAttachments))。宽度(100)。标题(附件);



和我的kendowindow



@(Html。 Kendo()。窗口()。名称(附件)

。标题(上传附件)

。可见(假)

.Modal(true)

.Draggable(true)

。宽度(350)











< script type =text / x-kendo-templateid =attachment >

上传



按钮onclick



< script type =text / javascript>



function myFunction(){

var ln = document.getElementById(NumInput)。value;

var fil = document.getElementById(files);

var filepath = fil.value;

var assetid = document.getElementById(hdassetid)。value;



$ .ajax({

类型:POST,

url:'/ Asset / SaveAssetAttachments',

data:{filename:ln,filepath:filepath,assetid:assetid},

成功:函数(数据){

$(#myWindow)。data(kendoWindow)。close();

},

})

};



这里是显示Attacments函数名为


function showAttachments(e){

e.preventDefault();

var attachmentTemplate = kendo.template($ (#attachment)。html());

var dataItem = this.dataItem($(e.currentTarget).closest(tr));

var wnd = $(#Attachments)。data(kendoWindow);



wnd.content(attachmentTemplate(dataItem));

wnd.center()。open();

}

& lt; scrip>



这里我要关闭kendowindow onupload sucess

解决方案

.ajax({

类型:POST,

url:'/ Asset / SaveAssetAttachments',

data:{filename:ln,filepath:filepath,assetid :assetid},

成功:函数(数据){


(#myWindow)。data(kendoWindow)。close( );

},

})

};



和这里显示Attacments函数时打开窗口的代码



function showAttachments(e){

e.preventDefault();

var attachmentTemplate = kendo.template(


(#attachment)。html());

var dataItem = this.dataItem(

I have this attachments column

columns.Command(command => command.Custom("Attachments").Click("showAttachments")).Width(100).Title("Attachments");

and my kendowindow

@(Html.Kendo().Window().Name("Attachments")
.Title("Upload Attachments")
.Visible(false)
.Modal(true)
.Draggable(true)
.Width(350)

)

And

<script type="text/x-kendo-template" id="attachment">
Upload

button onclick

<script type="text/javascript">

function myFunction() {
var ln = document.getElementById("NumInput").value;
var fil = document.getElementById("files");
var filepath = fil.value;
var assetid = document.getElementById("hdassetid").value;

$.ajax({
type: "POST",
url: '/Asset/SaveAssetAttachments',
data: { filename: ln, filepath: filepath, assetid: assetid },
success: function (data) {
$("#myWindow").data("kendoWindow").close();
},
})
};

and here is code for opening window when show Attacments function called

function showAttachments(e) {
e.preventDefault();
var attachmentTemplate = kendo.template($("#attachment").html());
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var wnd = $("#Attachments").data("kendoWindow");

wnd.content(attachmentTemplate(dataItem));
wnd.center().open();
}
<scrip>

Here i want to close kendowindow onupload sucess

解决方案

.ajax({
type: "POST",
url: '/Asset/SaveAssetAttachments',
data: { filename: ln, filepath: filepath, assetid: assetid },
success: function (data) {


("#myWindow").data("kendoWindow").close();
},
})
};

and here is code for opening window when show Attacments function called

function showAttachments(e) {
e.preventDefault();
var attachmentTemplate = kendo.template(


("#attachment").html());
var dataItem = this.dataItem(


这篇关于如何在按钮单击时通过jquery onsucess关闭kendo窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆