@(Html.Kendo().Grid<Works.Models.BBSViewModel>()
.Name("BBSGrid")
.Columns(columns => {
columns.Bound(p => p.ID).Title("ID").Width(40);
columns.Bound(p => p.AttachFile).HeaderTemplate("<i class='fa fa-paperclip fa-lg'></i>").Width(20);
columns.Bound(p => p.PublishedDate).Width(100).Format("{0:yyyy/MM/dd HH:mm}").Title("掲載日時");
columns.Bound(p => p.Title).Title("件名");
columns.Bound(p => p.SectionName).Width(90).Title("掲載部門");
columns.Bound(p => p.EmployeeName).Width(70).Title("掲載者");
})
.HtmlAttributes(new { style = "height: 500px;" })
.Scrollable()
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single)
.Type(GridSelectionType.Row))
.Events(events => events
.Change("onChange")
)
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("BBS_Read", "BBS"))
)
)
</div>
<script type="text/javascript">
function onChange(args) {
/*
var selected = $.map(this.select(), function (item) {
return $(item).text() + "|";
});
alert(selected);
*/
var goods = this.select();
goodsID = this.dataItem(goods).ID;
alert(goodsID);
}
</script>
0 件のコメント:
コメントを投稿