2013-10-05 40 views
0

我使用与它定义的自定义按钮剑道电网如下如何在自定义按钮打开剑道窗口

@(Html.Kendo().Grid((IEnumerable<AdjustmentModel >)ViewBag.Adjustments) 
    .Name("AdjustmentsGrid") 
    .DefaultConfiguration() 
    .HtmlAttributes(new { style = "height=100%" }) 
    .ToolBar(toolbar => { 
     toolbar.Custom().Text("Search"); 
     toolbar.Custom().Text("Apply Adjustment"); 
     toolbar.Custom().Text("Clear"); 
    }) 

我想在“应用调整”按钮打开一个窗口剑道。如何实现它? 如何在Kendo窗口上提供网格?

请让我知道。

谢谢。

回答

0
... 
toolbar.Custom().Text("Apply Adjustment").HtmlAttributes(new { @id = "applyadjust"}) 
... 

<div class="k-content"> 
    <div id="applyadjustmentwindow"></div> 
</div> 

<script> 
var window = $("#applyadjustmentwindow"), 
    applybtn = $("#applyadjust") 
     .bind("click", function() { 
      window.data("kendoWindow").open().center();     
     }); 

window.kendoWindow({ 
    title: "Apply Adjustment", 
    actions: ["Minimize", "Maximize", "Refresh", "Close"], 
    content: "URL to the action from which you are loading the html (can be partial view or plain html) on the window",   
    visible: false,   
    width: "50%" 
}); 

0

我这样做是这样的。

首先声明一个剑术窗口在分度显示:无

<div style="display:none"> 
 
    @(Html.Kendo().Window() .Name("MyWindowName") .Title("Test Window") .Content(@ 
 
    <text> 
 
    <p> 
 
     I am just for a demo 
 
    </p> 
 
    </text>) .Draggable() .Resizable() .Width(350) .Actions(actions => actions.Close())) 
 
</div>

然后在剑道网格工具栏添加一个按钮,

toolBar.Custom().Text("Open Window").Url("javascript:OpenKendoWindow()");

然后添加一个javascript函数

function OpenKendoWindow(e) { 
 
    $("#MyWindowName").data("kendoWindow").center(); // This will open the window on the center of the page 
 
}

完蛋了。