<!DOCTYPE
html>
<html>
<head>
<meta
name="viewport"
content="width=device-width"
/>
</head>
<body>
<div
class="options
k-button-add">
<a
href="#"
class="k-button"
name="viewEmp">Add
New Employee<span
class="infoIconinBtn"><img
src="~/Administration/Content/images/small-info-icon.png"
alt=""
class="img-responsive"
/>
</span></a>
<input
type="button"
id="delete-selected"
class="k-button"
value="Delete"
/>
</div>
<div
id="CreateEmp"
style="display:none;">
@Html.Partial("CreatePV",
new
Nop.Admin.Models.Emp.EmpModel()
{ NAME =null
})
</div>
<div
id="EditEmp"
style="display:none;">
</div>
<div
id="Emp-grid"></div>
@Html.TextBox("cal")
<script
id="delete-confirmation"
type="text/x-kendo-template">
<p
class="delete-message">Are
you sure to delete this picture?</p>
<button
class="delete-confirm
k-button">Yes</button>
<button
class="delete-cancel
k-button">No</button>
</script>
</body>
</html>
<script
type="text/javascript">
var
selectedIds = [];
$(function
()
{
$("a[name='viewEmp']").click(function
() {
var
window = $('#CreateEmp');
if
(!window.data('kendoWindow'))
{
window.kendoWindow({
modal:
true,
title:
'New
Emp',
actions:
['Close'],
width:
800,
draggable:
false,
resizable:
false,
visible:
false,
height:
250
});
}
window.data('kendoWindow').center().open();
return
false;
});
$('#cal').kendoDatePicker();
$("#Emp-grid").kendoGrid({
dataSource:
{
type:
"json",
transport:
{
read:
{
url:
"@Html.Raw(Url.Action("IndexKendoData",
"Emp"))",
type:
"POST",
dataType:
"json"
},
destroy:
{
url:
"@Html.Raw(Url.Action("Delete",
"Emp"))",
type:
"POST",
dataType:
"json"
}
},
schema:
{
data:
"Data",
total:
"Total",
errors:
"Errors",
model:
{
id:
"Id",
fields:
{
Name:
{ editable: true,
type: "string"
},
}
}
},
requestEnd:
function
(e) {
if
(e.type == "destroy"
|| e.type == "update")
{
this.read();
}
},
error:
function(e)
{
display_kendoui_grid_error(e);
this.cancelChanges();
},
pageSize:
5,
serverPaging:
true,
serverFiltering:
false,
serverSorting:
true
},
filterable:
{
extra:false,
operators:
{
string:{
contains: "Contains"}
}
},
pageable:
{
refresh:
true,
pageSizes:
5,
buttonCount:
5
},
editable:
{
confirmation:
true,
mode:
"inline"
},
scrollable:
false,
columnMenu:
true,
groupable:
true,
columns:
[
{
field:
"Id",
template:
"#=Id#",
hidden:
true
},
{
headerTemplate:
"<input
id='mastercheckbox' type='checkbox'/>",
headerAttributes:
{ style: "text-align:center"
},
attributes:
{ style: "text-align:center"
},
template:
"<input
type='checkbox' value='#=Id#' class='checkboxGroups'/>",
width:
50,
filterable:
false,
sortable:
false
},
{
field:
"Name",
title:
"Name",
filterable:
true
},
{
title:
"Action",
command:
[
{
name: "Edit",
text: "",
imageClass: "k-icon
k-edit",
click: Update },
{
name:
"destroy",
text:
"@T("Admin.Common.Delete")"
}
],
}
]
});
$('#mastercheckbox').click(function
() {
$('.checkboxGroups').attr('checked',
$(this).is(':checked')).change();
});
$('#delete-selected').click(function(e)
{
if
(confirm('Do
you want to delete it ?'))
{
if
(selectedIds.length == 0) {
return
false;
}
e.preventDefault();
var
postData = {
abc:
selectedIds
};
$.ajax({
cache:
false,
type:
"POST",
url:
"@(Url.Action("Deletemultiselect",
"Emp"))",
data:
postData,
complete:
function
(data) {
//reload
grid
var
grid = $('#Emp-grid').data('kendoGrid');
grid.dataSource.read();
},
error:
function
(xhr, ajaxOptions, thrownError) {
alert(thrownError);
},
traditional:
true
});
return
false;
}
else
{
var
grid = $('#Emp-grid').data('kendoGrid');
grid.dataSource.read();
}
});
$('#Emp-grid').on('change',
'input[type=checkbox][id!=mastercheckbox]',
function
(e) {
var
$check = $(this);
if
($check.is(":checked")
== true)
{
var
checked = jQuery.inArray($check.val(), selectedIds);
if
(checked == -1) {
//add
id to selectedIds.
selectedIds.push($check.val());
}
}
else
{
var
checked = jQuery.inArray($check.val(), selectedIds);
if
(checked > -1) {
//remove
id from selectedIds.
selectedIds
= $.grep(selectedIds, function
(item, index) {
return
item != $check.val();
});
}
}
});
function
Update(e)
{
var
window = $('#EditEmp');
var
dataItem = this.dataItem($(e.currentTarget).closest("tr"));
$.ajax({
cache:
false,
type:
"POST",
url:
"@(Url.Action("Editp",
"Emp"))",
data:
{ Id: dataItem.Id },
success:
function
(data) {
window.empty().append(data);
},
error:
function
(xhr, ajaxOptions, thrownError) {
alert(thrownError);
}
});
if
(!window.data('kendoWindow'))
{
window.kendoWindow({
modal:
true,
title:
'Edit
Employee',
actions:
['Close'],
width:
430,
draggable:
false,
resizable:
false,
visible:
false,
});
}
window.data('kendoWindow').center().open();
setTimeout(function
() {
$('.k-overlay').css('display',
'block');
},
500);
}
});
</script>
plane
gride
$("#serviceCallManagement-grid").kendoGrid({
dataSource:
{
type:
"json",
transport:
{
read:
{
url:
"@Html.Raw(Url.Action("ServiceCallListKendoData","ServiceCallDetails"))",
type:
"POST",
dataType:
"json"
}
},
schema:
{
data:
"Data",
total:
"Total",
errors:
"Errors"
},
error:
function(e)
{
display_kendoui_grid_error(e);
this.cancelChanges();
},
pageSize:
@(defaultGridPageSize),
serverPaging:
true,
serverFiltering:
false,
serverSorting:
false,
},
filterable:
{
extra:false,
operators:
{
string:{
contains: "Contains"}
}
},
pageable:
{
refresh:
true,
pageSizes:
[@(gridPageSizes)]
},
scrollable:
false,
selectable:
false,
columns:
[
{
field:
"AccountNo",
title:
"Account
No.",
width:200
},
{
field:
"accountName",
title:
"account
Name"
},
{
field:
"ServiceTicketNo",
title:
"Service
Ticket No."
},
{
field:
"ServiceCodeName",
title:
"Service
Code"
},
{
field:
"EquipmentName",
title:
"Equipment
Name"
},
{
field:
"EquipmentName",
title:
"Equipment
Name"
},
{
field:
"CallLogUtc",
title:
"Ticket
Created",
template:
"#=
kendo.toString(kendo.parseDate(CallLogUtc, 'yyyy-MM-dd'),
'MM/dd/yyyy') #"
},
{
field:
"ResolutionUtc",
title:
"Scheduled
Date"
},
{
field:
"ServiceResolutionStatusName",
title:
"Status"
}
]
}
);
how
to add templet fied in kendo gride
{
field:
"ModelName",
title:
"Model
Name",
template:
'<a
href="/admin/Modelmaster/Edit/#=Id#">#=ModelName#</a>'
},
add
kendo confirm popup in mvc
<script
id="delete-confirmation2"
type="text/x-kendo-template">
<div
style="width:200px">
<p
class="delete-message">Do
you want to delete(s) it?</p>
<button
class="delete-confirm
k-button">Yes</button>
<button
class="delete-cancel
k-button">No</button>
</div>
</script>
javascript
code
$('#delete-selected').click(function()
{
var
kendoWindow = $("<div
/>").kendoWindow({
title:
"Confirm",
resizable:
false,
modal:
true
});
kendoWindow.data("kendoWindow")
.content($("#delete-confirmation2").html())
.center().open();
kendoWindow
.find(".delete-confirm,.delete-cancel")
.click(function()
{
if
($(this).hasClass("delete-confirm"))
{
$.ajax({
cache:
false,
type:
"POST",
url:
"@(Url.Action("Deletemultiselect",
"ModelMaster"))",
data:
{Mid:selectedIds},
complete:
function
(data) {
var
grid = $('#Modelmaster-grid').data('kendoGrid');
grid.dataSource.read();
},
error:
function
(xhr, ajaxOptions, thrownError) {
alert(thrownError);
},
traditional:
true
});
kendoWindow.data("kendoWindow").close();
return
false;
}
else
{
var
grid = $('#Modelmaster-grid').data('kendoGrid');
grid.dataSource.read();
kendoWindow.data("kendoWindow").close();
}
})
});
gride
no record
,
dataBound: function ()
{
if
($('#serviceCallManagement-grid').find("tr").length==1)
{
$('#serviceCallManagement-grid').find('tbody')
.append('<tr
class="kendo-data-row"><td colspan="10"
style="text-align:center"><b>No Results
Found!</b></td></tr>');
}
}
filter
filterable:
true,
adding
colour in gride cell
dataBound:
function ()
{
var
grid = this;
grid.tbody.find('>tr').each(function(){
var
dataItem = grid.dataItem(this);
if(!dataItem.Status)
{
(this).cells[5].style.color
= "#bb0000";
$(this).addClass('disableRow');
}
else{
(this).cells[5].style.color
= "#068700";
}
})
}
for
search
function
additionalData() {
return
{
OrdermanagementSearch:
$('#txtSearch').val(),
};
}
//search
button
$('#btnSearch').click(function
() {
//search
var
grid = $('#orderManagement-grid').data('kendoGrid');
grid.dataSource.page(1);
//new
search. Set page size to 1
//grid.dataSource.read();
we already loaded the grid above using "page" function
return
false;
});
$('#txtSearch').keydown(function
(event) {
if
(event.keyCode == 13) {
$("#btnSearch").click();
return
false;
}
});
munir_shaikh@fulcrumww.com
timesheets.ind@eoktechnologies.com
complet
gride code
$(function
() {
$('#AID').change(function
() {
if
($('#AID
:selected').text()
!= "Select")
{
$('#btnTicket').removeAttr('disabled');
$.ajax({
cache:
false,
type:
"Get",
url:
"/OrderManagement/GetAccountNumber",
data:
{ Id: $(this).val()
},
success:
function
(data) {
$('#lbacountnumber').text(data);
},
error:
function
(xhr, ajaxOptions, thrownError) {
alert(thrownError);
}
});
}
else
{
$('#lbacountnumber').text('');
$('#btnTicket').attr('disabled',
'disabled');
}
});
$('#txtSearch').val('Search');
$('#txtSearch').focus(function
() {
$(this).val('');
});
$('#txtSearch').blur(function
() {
if
($(this).val().length
== 0)
$('#txtSearch').val('Search');
});
$("#orderManagement-grid").kendoGrid({
dataSource:
{
type:
"json",
transport:
{
read:
{
url:
"@Html.Raw(Url.Action("OrdermanagementListKendoData",
"OrderManagement"))",
type:
"POST",
dataType:
"json",
data:
additionalData
}
},
schema:
{
data:
"Data",
total:
"Total",
errors:
"Errors"
},
error:
function(e)
{
display_kendoui_grid_error(e);
this.cancelChanges();
},
pageSize:
@(defaultGridPageSize),
serverPaging:
true,
serverFiltering:
false,
serverSorting:
false,
},
filterable:
{
extra:false,
operators:
{
string:{
contains: "Contains"}
}
},
sortable:
{
mode:
"single",
allowUnsort:
false
},
pageable:
{
refresh:
true,
pageSizes:
[@(gridPageSizes)]
},
scrollable:
false,
selectable:
true,
change:
onChange,
columns:
[
{
field:
"Id",
template:
"#=Id#",
hidden:
true
},
{
field:
"AccountId",
template:
"#=AccountId#",
hidden:
true
},
{
field:
"SalesOrderNumber",
title:
"Sales
Order No.",
template:
'<a
href="/admin/SalesOrder/Index/#=Id#">#=SalesOrderNumber#</a>'
},
{
field:
"AccountNo",
title:
"Account
No.",
},
{
field:
"AccountName",
title:
"Account
Name",
filterable:
true
},
{
field:
"OrderPlacedDate",
title:
"Order
Placed Date",
template:
"#=
(OrderPlacedDate == null) ? '' : kendo.toString(OrderPlacedDate,
'MM/dd/yyyy') #",
type:
"date",
format:
"{0:MM/dd/yyyy}",
filterable:
true,
},
{
field:
"DeliveryDate",
title:
"Order
Delivery Date",
template:
"#=
(DeliveryDate == null) ? '' : kendo.toString(DeliveryDate,
'MM/dd/yyyy') #",
type:
"date",
format:
"{0:MM/dd/yyyy}",
filterable:
true,
},
{
field:
"PlaceToDeliver",
title:
"Place
To Deliver",
filterable:
true,
},
{
field:
"Status",
title:
"Status",
filterable:
true,
}
],
dataBound: function
()
{
if
($('#orderManagement-grid').find("tr").length==1)
{
$('#orderManagement-grid').find('tbody')
.append('<tr
class="kendo-data-row"><td colspan="7"
style="text-align:center"><b>No Results
Found!</b></td></tr>');
}
var
grid = this;
grid.tbody.find('>tr').each(function(){
var
dataItem = grid.dataItem(this);
if(dataItem.Status=="Order
Placed")
(this).cells[7].style.color
= "#bb0000";
else
if(dataItem.Status=="Awaiting
Approval")
(this).cells[7].style.color
= "#0000FF
";
else
(this).cells[7].style.color
= "#068700";
})
}
}
);
function
onChange(e) {
var
grid = $('#orderManagement-grid').data('kendoGrid');
var
selectedItem = grid.dataItem(grid.select());
location.href=
"/SalesOrder/Index/"+selectedItem.AccountId+"?OrderId="+selectedItem.Id;
}
function
additionalData() {
return
{
OrdermanagementSearch:
$('#txtSearch').val(),
};
}
$('#btnSearch').click(function
() {
var
grid = $('#orderManagement-grid').data('kendoGrid');
grid.dataSource.page(1);
return
false;
});
$('#txtSearch').keydown(function
(event) {
if
(event.keyCode == 13) {
$("#btnSearch").click();
return
false;
}
});
});
how
to add image in kendo gride.
{
field:
"Automatic",
title:
"Automatic",
template:
'#if(Automatic){#<span
class="checkimg"></span>#} else
{##}#',
filterable:
true,
},
filterable
ingride
$("#equipment-grid").kendoGrid({
dataSource:
{
type:
"json",
transport:
{
read:
{
url:
"@Html.Raw(Url.Action("IndexKendoData",
"Equipment"))",
type:
"POST",
dataType:
"json",
data:
additionalData
},
destroy:
{
url:
"@Html.Raw(Url.Action("MarkedAsDeleted",
"Equipment"))",
type:
"POST",
dataType:
"json"
}
},
schema:
{
data:
"Data",
total:
"Total",
errors:
"Errors",
model:
{
id:
"Id",
fields:
{
//'AcDocumentType.AcDocumentTypeName':
{ editable: false, type: "string" } ,
EquipmentID:
{ editable: false,
type: "string"
} ,
//StartDate:
{ editable: true, type: "date" } ,
//EndDate:
{ editable: true, type: "date" } ,
CostPrice:
{ editable: false,
type: "number"
}
}
}
},
error:
function(e)
{
display_kendoui_grid_error(e);
//
Cancel the changes
this.cancelChanges();
},
pageSize:
@(defaultGridPageSize),
serverPaging:
true,
serverFiltering:
false,
serverSorting:
false
},
filterable:
{
extra:false,
operators:
{
string:{
contains: "Contains"}
}
},
sortable:
{
mode:
"single",
allowUnsort:
false
},
pageable:
{
refresh:
true,
pageSizes:
[@(gridPageSizes)]
},
scrollable:
false,
selectable:
true,
change:
onChange,
columns:
[
{
field:
"Id",
title:"Check",
attributes:
{ style: "text-align:center"
},
template:
"<a
href='Equipment/Edit/#=Id#'><input type='checkbox'
value='#=Id#' class='checkboxGroups'/></a>",
width:
50,
filterable:
false,
attributes:
{
"class":
"tbldefault"},
altRowTemplate:'<a
href="Equipment/Edit/#=Id#"><tr><td></td></tr></a>'
},
{
field:
"EquipmentID",
title:
"@T("Admin.Equipment.Fields.EquipmentID")",
filterable:
true,
template:
'<a
href="Equipment/Edit/#=Id#">#=EquipmentID#</a>'
},
{
field:
"SerialNo",
title:
"@T("Admin.Equipment.Fields.SerialNo")",
width:
100,
filterable:
true,
template:
'<a
href="Equipment/Edit/#=Id#">#=SerialNo#</a>'
},{
field:
"PictureId",
title:"Image",
template:
'<a
href="Equipment/Edit/#=Id#"><img src="#=PictureId#"
/></a>'
},{
field:
"ManufacturerName",
title:
"@T("Admin.Equipment.Fields.ManufacturerID")",
filterable:
true,
template:
'<a
href="Equipment/Edit/#=Id#">#=ManufacturerName#</a>'
},{
field:
"ModelName",
title:
"@T("Admin.Equipment.Fields.ModelID")",
filterable:
true,
template:
'<a
href="Equipment/Edit/#=Id#">#=ModelName#</a>'
},
{
field:
"ModelTypeName",
title:
"@T("Admin.Equipment.Fields.ModelTypeID")",
filterable:
true,
template:
'<a
href="Equipment/Edit/#=Id#">#=ModelTypeName#</a>'
},{
title:
"Account
Address"
},
{
field:
"StatusName",
title:
"@T("Admin.Equipment.Fields.StatusID")",
filterable:
true,
template:
'<a
href="Equipment/Edit/#=Id#">#=StatusName#</a>'
},
{
field:
"CostPrice",
//title:
"@T("Admin.Equipment.Fields.SellPrice")",
title:
"Cost($)",
filterable:
{
operators:
{
number:
{
eq:
"Is
equal to",
neq:
"Is
not equal to",
gte:
"Is
after or equal to",
gt:
"Is
after",
lte:
"Is
before or equal to",
lt:
"Is
before",
}
}
},
template:
'<a
href="Equipment/Edit/#=Id#">#=CostPrice#</a>'
},{
title:
"Action",
command:
[{
name:
"Delete",
text:"",
imageClass: "k-icon
k-delete",
click: function
(e) {
e.preventDefault();
var
dataItem = this.dataItem($(e.target).closest("tr"));
//*******
var
kendoWindow = $("<div
/>").kendoWindow({
title:
"Confirm",
resizable:
false,
modal:
true
});
kendoWindow.data("kendoWindow")
.content($("#delete-confirmation").html())
.center().open();
kendoWindow
.find(".delete-confirm,.delete-cancel")
.click(function()
{
if
($(this).hasClass("delete-confirm"))
{
var
dataSource = $("#equipment-grid").data("kendoGrid").dataSource;
dataSource.remove(dataItem);
dataSource.sync();
}
kendoWindow.data("kendoWindow").close();
})
.end()
}
}],
//width:
200
}
]
}
);
});
function
onChange(e) {
var
eventTarget = (event.target) ? $(event.target) : $(event.srcElement);
var
isAction = eventTarget.parent().hasClass('k-button
k-button-icontext k-grid-delete');
var
grid = $('#equipment-grid').data('kendoGrid');
var
selectedItem = grid.dataItem(grid.select());
var
equipmentId = selectedItem.Id;
if(!isAction)
{
var
equipmentDetailsActionUrl = '@Html.Raw(Url.Action("Edit",
"Equipment",
new
{ Id = "equipmentidplaceholder"
}))';
equipmentDetailsActionUrl
= equipmentDetailsActionUrl.replace("equipmentidplaceholder",
equipmentId);
setLocation(equipmentDetailsActionUrl);
}
else
{
$.ajax({
cache:false,
type:
"POST",
url:
"@(Url.Action("MarkedAsDeleted",
"Equipment"))",
data:
{ "Id":equipmentId
},
success:
function
(data) {
$('#equipment-grid').data('kendoGrid').dataSource.read();
$('#equipment-grid').data('kendoGrid').dataSource.page(1);
$('#equipment-grid').data('kendoGrid').refresh();
},
error:function
(xhr, ajaxOptions, thrownError){
alert('Failed
to add product picture.');
}
});
}
}
function
additionalData() {
return
{
SearchEquipment:
$('#@Html.FieldIdFor(model
=> model.SearchEquipment)').val(),
}
}
Example
of kendo gride for some field edit
$("#EquipmentLocation-grid").kendoGrid({
dataSource:
{
type:
"json",
transport:
{
read:
{
url:
"@Html.Raw(Url.Action("KendoDataLocation",
"Barcode",
new
{ Id = Model.equipmentLocationModel.EquipmentId }))",
type:
"POST",
dataType:
"json",
data:
additionalData
},update:
{
url:"@Html.Raw(Url.Action("EditLocation",
"Barcode"))",
type:
"POST",
dataType:
"json"
},
destroy:
{
url:
"@Html.Raw(Url.Action("DeleteLocation",
"Barcode"))",
type:
"POST",
dataType:
"json"
}
},
schema:
{
data:
"Data",
total:
"Total",
errors:
"Errors",
model:
{
id:
"Id",
fields:
{
Location:
{ editable: false,
type: "string"
},
AccountName:
{ editable: false,
type: "string"
},
AccountAddress:
{ editable: false,
type: "string"
},
WarehouseName:
{ editable: false,
type: "string"
},
RouteNo:
{ editable: false,
type: "string"
},
PriorityService:
{ editable: false,
type: "string"
},
FromDate:
{ editable: true,
type: "date"
},
ToDate:
{ editable: true,
type: "date"
},
}
}
},
requestEnd:
function
(e) {
if
(e.type == "destroy"
|| e.type == "update")
{
this.read();
}
},
error:
function(e)
{
display_kendoui_grid_error(e);
//
showError(e.errors);
this.cancelChanges();
},
pageSize:
@(defaultGridPageSize),
serverPaging:
true,
serverFiltering:
false,
serverSorting:
false,
},
filterable:
{
extra:false,
operators:
{
string:{
contains: "Contains"}
}
},
sortable:
{
mode:
"single",
allowUnsort:
true
},
pageable:
{
refresh:
true,
pageSizes:
[@(gridPageSizes)]
},
editable:
{
confirmation:
true,
mode:
"inline"
},
scrollable:
false,
selectable:
true,
change:
onChange,
columns:
[{
field:
"Id",
template:
"#=Id#",
hidden:
true,
width:"5%"
},{
field:
"Location",
title:
"Location",
template:
'#if(IsCustomerLocation){#Account#}
else if(IsWarehouse){#Warehouse#} else if(IsRoute){#Route#} #',
filterable:
true,
width:"10%"
},{
field:
"AccountName",
title:
"Account
Name",
filterable:
true,
width:"10%"
},{
field:
"AccountAddress",
title:
"Account
Address",
//template:
'#if(IsCustomerLocation){#AccountAddress#} else {#----#}#',
filterable:
true,
width:"15%"
},{
field:
"WarehouseName",
title:
"Warehouse
Name",
//
template: '#if(IsWarehouse){#WarehouseName#} else {#----#}#',
filterable:
true,
width:"10%"
},{
field:
"RouteNo",
title:
"Route
No",
//template:
'#if(IsRoute){#RouteNo#} else {#----#}#',
filterable:
true,
width:"5%"
},{
field:
"PriorityService",
title:
"Priority
Service",
//template:
'#if(PriorityService){#Yes#} else {#No#}#',
filterable:
true,
width:"5%"
},{
field:
"FromDate",
title:
"From
Date",
type:
"date",
format:
"{0:MM/dd/yyyy}",
filterable:
true,
width:"15%"
},{
field:
"ToDate",
title:
"To
Date",
type:
"date",
format:
"{0:MM/dd/yyyy}",
filterable:
true,
width:"15%"
},{
title:
"Action",
width:"10%",
command:
[{
name:
"edit",
text:
"",
imageClass:
"k-icon
k-edit",
click: function
(e) {
//showError(e.errors);
}
},
{
name:
"Delete",
text:"",
imageClass: "k-icon
k-delete",
click: function
(e) {
e.preventDefault();
var
dataItem = this.dataItem($(e.target).closest("tr"));
//*******
var
kendoWindow = $("<div
/>").kendoWindow({
title:
"Confirm",
resizable:
false,
modal:
true,
width:500,
height:200
});
kendoWindow.data("kendoWindow")
.content($("#delete-confirmation").html())
.center().open();
kendoWindow
.find(".delete-confirm,.delete-cancel")
.click(function()
{
if
($(this).hasClass("delete-confirm"))
{
var
dataSource =
$("#EquipmentLocation-grid").data("kendoGrid").dataSource;
dataSource.remove(dataItem);
dataSource.sync();
}
kendoWindow.data("kendoWindow").close();
})
.end()
}
}]
}
],
dataBound:
function
()
{
var
cnt =
$('#EquipmentLocation-grid').data('kendoGrid').dataSource.total();
if
(cnt == 0) {
$('#EquipmentLocation-grid').find('tbody')
.append('<tr
class="kendo-data-row"><td colspan="6"
style="text-align:center"><b>No Results
Found!</b></td></tr>');
}
}
});
//search
button
$('#btnSearch').click(function
() {
//search
var
grid = $('#EquipmentLocation-grid').data('kendoGrid');
grid.dataSource.page(1);
//new
search. Set page size to 1
//grid.dataSource.read();
we already loaded the grid above using "page" function
return
false;
});
$("#@Html.FieldIdFor(model
=> model.SearchEquipmentLocation)").keydown(function
(event) {
if
(event.keyCode == 13) {
$("#btnSearch").click();
return
false;
}
});
function
additionalData() {
return
{
SearchEquipmentLocation:
$('#@Html.FieldIdFor(model
=> model.SearchEquipmentLocation)').val()
};
}
function
showError(message){
var
window = $('#errorMessage');
if
(!window.data('kendoWindow'))
{
window.kendoWindow({
modal:
true,
title:
'Confirm',
actions:
['Close'],
width:500,
height:200
});
}
window.data('kendoWindow').center().open();
return
false;
}
function
onChange(e) {
//var
grid = $('#Notes-grid').data('kendoGrid');
//var
selectedItem = grid.dataItem(grid.select());
//var
NoteId = selectedItem.Id;
//setLocation(NoteDetailsActionUrl);
}
No comments:
Post a Comment