var GridSummaryManager = {
gridDataSource: function () {
var gridDataSource = new kendo.data.DataSource({
type: "json",
serverPaging: true,
serverSorting: true,
serverFiltering: true,
allowUnsort: true,
pageSize: 10,
transport: {
read: {
url: '../Unit/GetUnitSummary/',
type: "POST",
dataType: "json",
contentType: "application/json; charset=utf-8"
},
parameterMap: function (options) {
return JSON.stringify(options);
}
},
schema: {
data: "Items", total: "TotalCount",
model: {
fields: {
ExpDate: {
type: "date",
template: '#= kendo.toString("dd-MMM-yyyy") #',
editable: false
}
}
},
}
});
return gridDataSource;
}
};
var GridSummaryHelper = {
InitUnitSummary: function () {
GridSummaryHelper.GenerateGrid();
},
GenerateGrid: function () {
$("#grdSummary").kendoGrid({
dataSource: GridSummaryManager.gridDataSource(),
pageable: {
refresh: true,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
filterable: true,
sortable: true,
columns: GridSummaryHelper.GenerateColumns(),
editable: false,
navigatable: true,
selectable: "row"
});
},
GenerateColumns: function () {
return columns = [
{ field: "UnitId", hidden: true },
{ field: "UnitName", title: "Unit Name", width: 70, editable: false },
{ field: "CompanyName", title: "Company Name", width: 70, editable: false },
{ field: "UnitNameBan", title: "Unit Name (Bangla)", width: 70, editable: false },
{ field: "IsActive", title: "Activity", width: 50, editable: false, template: '#=IsActive==true?"Active":"InActive"#' },
{ field: "Edit", title: "Edit/View", filterable: false, width: 30, template: '<button type="button" class="btn btn-default btn-sm" value="Edit" id="btnEdit" onClick="UnitSummaryHelper.clickEventForEditButton()" ><span class="glyphicon glyphicon-edit"></span></button>', sortable: false }
];
},
clickEventForEditButton: function () {
var entityGrid = $("#grdUnitSummary").data("kendoGrid");
var selectedItem = entityGrid.dataItem(entityGrid.select());
For New Version:
===================================
e.preventDefault();
var grid = $("#grdBuyerCostingSummary").data("kendoGrid");
var tr = $(e.currentTarget).closest("tr");
var selectedItem = this.dataItem(tr);
grid.select(tr);
=================================
if (selectedItem != null) {
GridDetailsHelper.FillForm(selectedItem);
}
},
};
No comments:
Post a Comment