[英]Kendo Grid and Modal MVC 5
我正在嘗試顯示我的劍道網格的選定行:
@(Html.Kendo().Grid<Solution.ViewModels.ItemViewModel>()
.Name("myGrid")
.Columns(columns =>
{
columns.Bound(c => c.item1);
columns.Bound(c => c.item2);
columns.Bound(c => c.item3);
}).HtmlAttributes(new { style = "text-align: center;" })
.Sortable()
.Pageable(pageable => pageable
.ButtonCount(5))
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single)
.Type(GridSelectionType.Row))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetItem", "ItemTest"))
.ServerOperation(true)
.PageSize(20))
.Events( events=> events.Change("onItemChange").DataBound("onGridDataBound"))
與此js:
@section ScriptsBottom
{
<script type="text/javascript">
// On grid row selection/click
function onItemChange(e) {
var grid = e.sender;
var selectedItem = grid.dataItem(this.select());
$('#modal').data(selectedItem);
}
function displaySelectedItem() {
$('#modal');
}
</script>
}
我不知道如何將所選行的數據綁定並顯示到我的彈出窗口,您能幫我嗎?
以下示例顯示了一個非常相似的方案:
這個想法是將kendo.bind()
與模式容器一起使用,並傳遞所選的數據項對象。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.