2013-10-05 43 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 
 
}

完蛋了。