@{ ViewBag.Title = "PRP Members";}<h2>PRP Members</h2>@Html.Partial("_LastViewedUserFacility")<div class="filter"> <label class="filter-label" for="filter">Filter:</label> @(Html.Kendo().DropDownList() .Name("Filter") .DataTextField("Code") .DataValueField("ID") .Events(e => e.Change("onChange")) .BindTo((System.Collections.IEnumerable)ViewData["PRPs"]) )</div><br class="clear" /><br />@(Html.Kendo().Grid<PASSAdmin.ViewModels.UserFacilityAdmin.PRPMemberViewModel>() .Name("PRPMembers") .Columns(columns => { columns.Command(command => { command.Edit(); }).Width(90); columns.Bound(c => c.First_Name).Title("First Name"); columns.Bound(c => c.Last_Name).Title("Last Name"); columns.Bound(c => c.Chair); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("UserFacilityAdmin/PRPMember").Window(window => window.Width(400))) .Sortable() .AutoBind(true) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(m => m.Pool_ID); model.Field(f => f.Pool_ID); }) .Create(create => create.Action("AddPRPMember", "UserFacilityAdmin")) .Read(read => read.Action("GetPRPMembers", "UserFacilityAdmin").Data("additionalData")) .Update(update => update.Action("UpdatePRPMember", "UserFacilityAdmin")) ))<script type="text/javascript">function additionalData(e) { var value = $('#Filter').data('kendoDropDownList').value(); return { prpID: value };}function onChange() { $('#PRPMembers').data('kendoGrid').dataSource.page(1);}</script>
I want to hide/remove one column when the data exported to excel..But that should be visible in grid. Can anybody please help regarding this ?? Thanks in advance.
Here is my whole code :
<div class="container content-xs" style="padding-top:10px">
<form id="EnableAssForm" action="/admin/EnableAssesmentStatus/"
method="post">
<div class="row">
@Html.Partial("_AdminSideBar")
<div class="col-md-9">
<div class="panel panel-default">
<!-- Default panel contents -->
<a title="add new ground" class="btn btn-success btn-sm
pull-right showwaiting" href="@Url.Action("Create")"><i class="fa
fa-plus-square fa-margin"></i>Add</a>
@(Html.Kendo().Grid<Database.Model.UserSummaryInfo>()
.Name("Grid")
.Columns(col =>
{
col.Bound(c => c.ApplicationUserId).Hidden();
col.Bound(c => c.MemberId).Title("Member ID");
col.Bound(c => c.Visit).Title("Visit");
col.Bound(c => c.CreatedDate).Title("Visit Start Date");
col.Bound(c => c.LogInCount).Title("LogIn Count");
col.Bound(c => c.SurveyStatus).Title(" Survey Status");
col.Bound(c => c.ApplicationUserId).HeaderTemplate(@<text>Action</text>).ClientTemplate("# if(SurveyStatus == 'Did Not Attempt') { #" + "<a class='btn btn-primary disabled' style='display: none;' href='" + Url.Action("TestDetails", "Admin") + "?id=#= TestSummaryId #&Year=#=Year#'" + " >Details</a>" + "# }else{#" + "<a class='btn btn-primary enabled' style='width:60px' href='" + Url.Action("TestDetails", "Admin") + "?id=#= ApplicationUserId #&Year=#=Year #&testSummaryId=#=TestSummaryId#'" + ">Details</a>" + "# }#")
.HeaderHtmlAttributes(new { style = "text-align: center;font-size:18px" });
})
.ToolBar(toolbar => toolbar.Template(@<text>
<div class="pull-left index-header">Test Summary</div>
<button type="button" class="btn btn-primary rounded pull-right margin-right-10" onclick="clearFiter()"><i class="fa fa-times-circle-o margin-right-5"></i> Clear Filter</button>
<a style="padding-right:5px;" class="k-button-icontext k-grid-excel btn btn-primary pull-right margin-right-10" href="#"><span class="fa fa-file-excel-o"></span>Export to Excel</a>
</text>))
.Excel(excel => excel
.FileName(DateTime.Now.Date.ToShortDateString() + " " + "GetUserSummary.xlsx")
.AllPages(false)
.ProxyURL(Url.Action("Excel_Export_Save", "Admin")))
.Pageable(paging => paging.PageSizes(new int[] { 100, 500, 1000 }).Refresh(true).ButtonCount(5).Info(true).Input(true))
.Sortable(sortable =>
{
sortable.SortMode(GridSortMode.SingleColumn);
})
.Groupable()
.Scrollable(s => s.Height("auto"))
.Filterable(filterable => filterable.Operators(operators => operators.ForNumber(nmbr => nmbr.Clear().IsEqualTo("Is equal to").IsLessThan("Less than").IsGreaterThan("Greater than").IsNotEqualTo("Not equal to")).ForString(str => str.Clear().Contains("Contains").IsEqualTo("Is equal to").StartsWith("Starts with").IsNotEqualTo("Is not equal to")).ForDate(date => date.Clear().IsGreaterThan("Is after").IsLessThan("Is Before").IsGreaterThanOrEqualTo("Is after or equal to").IsLessThanOrEqualTo("Is before or equal to"))))
.Resizable(resize => resize.Columns(true))
.Events(e => e.ExcelExport("Hidecolumn"))
.DataSource(datasource =>
datasource
.Ajax()
.Sort(sort => {
sort.Add(c => c.MemberId).Ascending();
sort.Add(c => c.Visit).Ascending();
})
.PageSize(10)
.Read(read => read.Action("GetUserSummaryList", "Admin"))
)
)
</div>
</div>
</div>
<!-- End Content -->
</form>
</div>
<script>
var exportFlag = false;
$("#Grid").data("kendoGrid").bind("excelExport", function (e) {
debugger;
if (!exportFlag) {
e.sender.hideColumn(2);
e.preventDefault();
exportFlag = true;
setTimeout(function () {
e.sender.saveAsExcel();
});
} else {
e.sender.showColumn(2);
exportFlag = false;
}
});
function Hidecolumn(e) {
e.sender.hideColumn(2);
}
</script>


I have grid with nullable int foreign key:
Create method work as expected, foreign key value is present in the model, but when i try to edit foreign key value to null, or cancel edit without setting value, i'm getting javascript error:
VM1494:3 Uncaught TypeError: Cannot set property 'Value' of null at eval (eval at setter (kendo.all.js:2118), <anonymous>:3:24) at o._set (kendo.all.js:4963) at o.accept (kendo.all.js:5180) at kendo.all.js:7018 at init._eachItem (kendo.all.js:6996) at init._cancelModel (kendo.all.js:7014) at init.cancelChanges (kendo.all.js:6880) at init.cancelRow (kendo.all.js:61601) at init._editCancelClick (kendo.all.js:61319) at HTMLAnchorElement.proxy (VM1001 jquery-3.3.1.js:10268)
I tried GridForeignKey template and custom template with ValuePrimitive set to true.
Custom template:
@( Html.Kendo().DropDownListFor(m => m) .OptionLabel("") .AutoBind(false) .BindTo((System.Collections.IEnumerable)ViewData["dictionaryType_Data"]) .DataValueField("Id") .DataTextField("Name") .ValuePrimitive(true))
Model:
public class DictionaryTypeModel{ public DictionaryTypeModel() { } public int Id { get; set; } public string Code { get; set; } public string Name { get; set; } public int? ParentId { get; set; } public string Deleted { get; set; }}
Grid:
@(Html.Kendo().Grid<RDEapp.Models.DictionaryTypeModel>() .Name("DictionaryTypeGrid") .Columns(c => { c.Bound(m => m.Name); c.Bound(m => m.Code); c.Bound(m => m.Deleted); c.ForeignKey(m => m.ParentId, (List<RDEapp.Models.TypSlownikaModel>)ViewData["dictionaryType_Data"], "Id", "Name") c.Command(command => { command.Edit().Text("Edit"); command.Custom("Delete").IconClass("k-icon k-i-delete").Click("deleteType"); }).Width(200); }) .ToolBar(toolbar => toolbar.Create().Text("Add dictionary type")) .Editable(edit => edit.Mode(GridEditMode.InLine).DisplayDeleteConfirmation(false)) .Selectable(selectable => selectable .Mode(GridSelectionMode.Single) .Type(GridSelectionType.Row)) .DataSource(dataSource => dataSource .Ajax() .PageSize(25) .Model(model => { model.Id(u => u.Id); model.Field(u => u.Id).Editable(false); model.Field(u => u.Deleted).Editable(false).DefaultValue("N"); model.Field(u => u.ParentId.Value).Editable(true); model.Field(u => u.Name).Editable(true); model.Field(u => u.Code).Editable(true); }) .Read(u => u.Action(RDEapp.Controllers.AdminController.NazwyMetod.DictionaryTypeRead, RDEapp.Controllers.AdminController.Name)) .Create(create => create.Action("AddDictionaryType", RDEapp.Controllers.AdminController.Name)) .Update(upd => upd.Action("EditDictionaryType", RDEapp.Controllers.AdminController.Name)) .Destroy(del => del.Action("DeleteDictionaryType", RDEapp.Controllers.AdminController.Name)) .Events(e => e.Error("crudErrors")) ) .Pageable() )
I am using editor template for child grid column. It is rendering for the first child grid. Like seeing in attached picture it is not rendering for the second child grid.
columns.Bound(p => p.RoleId).EditorTemplateName("UserRole").Title(ViewBag.Location).ClientTemplate("\\#:RoleName\\#");

columns.Command(command => { command.Edit(); command.Custom("InvoiceDetails"); command.Destroy(); }).Width(200);commands.Custom("InvoiceDetails").Action("Details", "Invoice").DataRouteValues

I've got a grid with a client template and need to escape the conditional statement active, but I can't work out how to do it.
I've tried
col.Bound(c => c.Active).ClientTemplate("\\# if (Active == true) {#<button class='btn btn-success'>\\#: Active\\#</button>#} \\#");col.Bound(c => c.Active).ClientTemplate("# if (\\Active\\ == true) {#<button class='btn btn-success'>\\#: Active\\#</button>#} #");​​col.Bound(c => c.Active).ClientTemplate("# if (\\#:Active\\# == true) {#<button class='btn btn-success'>\\#: Active\\#</button>#} #");Template code:
<script type="text/x-kendo-tmpl" id="projectsGridClientTemplate"> @( Html.Kendo().Grid<TeamProjectViewModel>().Name("projectGridDetail_#=Id#") .Columns(col => { col.ForeignKey(c => c.TeamId, (SelectList)ViewBag.Teams); col.ForeignKey(c => c.ProjectId, (SelectList)ViewBag.Projects); col.Bound(c => c.Active).ClientTemplate("# if (Active == true) {#<button class='btn btn-success'>\\#: Active\\#</button>#}#"); }) .DataSource(ds => { ds.Ajax().Read(r => r.Action("GetTeamProjects", "ResourcePlannerApi", new { @projectId = "#=Id#" })); }) .ToClientTemplate() )</script>
I have a grid where I created a Custom button on it, alongside an Edit button. I also have a wee bit of javascript that adds an icon to it. When the grid first displays, the icon is there. But when I click the Edit button (and after the edit popup closes), the custom icon is no longer there. Any ideas?
Here is my grid code:
@(Html.Kendo().Grid<ClientWithAdminFee>() .Name("clientList") .AutoBind(false) .Resizable(r => r.Columns(true)) .Columns(col => { col.Bound(c => c.ClientId); col.Bound(c => c.ClientName).Width(900); col.Bound(c => c.Status); col.Bound(c => c.AdminFee).Title("Active Admin Fee").HtmlAttributes(new {style = "text-align:right; padding-right: 3px"}).Format("{0:n2} %"); col.Bound(c => c.EffectiveFrom).HtmlAttributes(new {style = "text-align:right; padding-right: 3px"}).Format("{0:d}"); col.Command(c => c.Edit()); col.Command(c => c.Custom("History").Click("showHistory")); }) .Editable(e => e.Mode(GridEditMode.PopUp).TemplateName("AdminFeeEdit").Window(w => w.Width(525))) .DataSource(ds => ds .Ajax() .Model(m => { m.Id(d => d.ID); m.Field(d => d.ClientId); m.Field(d => d.ClientName); m.Field(d => d.Status); m.Field(d => d.AdminFee); m.Field(d => d.EffectiveFrom); m.Field(d => d.EffectiveTo); }) .Filter(f => f.Add(a => a.Status).IsEqualTo("A")) .Read(r => r.Action("GetClientsForAgent", "MGABilling").Data("additionalData").Type(HttpVerbs.Get)) .Update(u => u.Action("SaveAdminFee", "MGABilling")) .Events(e => e.RequestEnd("refreshGrid")) ) .Events(e => { e.DataBound("gridBound"); e.Edit("centerWindow"); }) .ToolBar(tb => tb.Template(@<div style="float: right;"><label>Only Active Clients:</label><input type="checkbox" id="chkStatus" checked/></div>)))
The javascript that adds the icon is part of the DataBound Event:
function gridBound(e) { var filter = this.dataSource.filter(); this.thead.find(".k-header-column-menu.k-state-active").removeClass("k-state-active"); if (filter) { var filteredMembers = {}; setFilteredMembers(filter, filteredMembers); this.thead.find("th[data-field]").each(function () { var cell = $(this); var filtered = filteredMembers[cell.data("field")]; if (filtered) { cell.find(".k-header-column-menu").addClass("k-state-active"); } }); } // adding icons to custom command buttons var span = "<span class='k-icon k-i-reorder'></span>"; e.sender.tbody.find(".k-grid-History").prepend(span);}
It's the bottom 2 lines that add the icon.
User fill out some search criteria to populate an in-cell batch editable grid. After making all of their changes they click a save button. This triggers the grid update which in turn calls a controller that updates the data. On request call the read action passing in the search criteria(to refresh the grid).
The update SQL updates the current task to complete, and if it meets certain criteria, inserts new child records.
What I am seeing in the database is that the same records are being updated many times. That isn't great but what is worse is that new child records are being created.
What do I have wired incorrectly? Is update being called multiple times? Are records not getting their modified flag cleared?
Here is my view and controller. They are stripped down but should have adequate info.
public class ViewPage1Controller : Controller
{
private readonly RmsContext2 _context;
RmsContext2 context = new RmsContext2(null);
FieldManagementContext contextFM = new FieldManagementContext(null);
public ViewPage1Controller(RmsContext2 context)//IMediator mediator)
{
_context = context;
}
public ActionResult Search([DataSourceRequest] DataSourceRequest request, SearchCriteria criteria)
{
var param13 = new SqlParameter { ParameterName = "DateType", Value = criteria.DateType };
var result = context.Database.SqlQuery<SearchResult>("PR_Review_Results @ToPortalId, @ProjectIds, @StoreId, @StatusId, @TypeId, @FromPortalId, @DistrictId, @DateFrom, @DateTo, @IncludeOutstanding, @ReportTag, @IncludeUnsubmit, @DateType",
param, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13);
return Json(result.ToList().ToDataSourceResult(request), "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet);
}
public ActionResult Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<SearchResult> results, SearchCriteria criteria)
{
if (ModelState.IsValid)
{
//for each updated record
//update image status, description and date
//update task status and date
//create any new tasks as children for rejected
using (var db = new RmsContext2(null))
{
foreach (var result in results)
{
db.Database.ExecuteSqlCommand("PR_Review_Update @PortalAccountId, @ActivityId, @ImageId, @ImageStatus, @Description, @Comment, @FollowUpDate, @FeedbackId, @TemplateId, @FollowUpActivityTypeId, @RefImageId, @IncludeMaster",
param, param2, param4, param5, param6, param7, param8, param3, param9, param10, param11, param12);
}
}
}
return Json(results.ToDataSourceResult(request, ModelState));
}
}
@model IEnumerable<PortalApp.Areas.TaskManagement.Features.AdvPhotoReview.Index.SearchResult>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Deferred(true)
.Events(events => events.DataBound("databound"))
.Columns(columns =>
{
columns.Bound(p => p.SmallImage64)
.ClientTemplate("<a href='../TaskManagement/AdvPhotoReview/Compare?imageId=#=ImageId#' target='blank'><img src='data:image/png;base64,#=SmallImage64#' onmouseover='showCompare(event)' onmouseout='hideCompare(event)' /></a><br /><img src='../Images/SmallIcons/Flip.png' onclick='flipImage(event)' /><img src='../Images/SmallIcons/RotateLeft.png' onclick='rotateleftImage(event)' /><img src='../Images/SmallIcons/RotateRight.png' onclick='rotaterightImage(event)' />")
.Title("Photo").Width(100).Filterable(false).Editable("imageEditable").Sortable(false).HtmlAttributes(new { style = "text-align: center;" });
columns.Template(@<text></text>)
.ClientTemplate(
"# var temp = AllComments; if (temp.length > 0) { #" +
"<img src='../Images/48X48/comments.png' onclick='showComments(event)' />" +
"# } else { #" +
"<img src='' />" +
"# } #"
).Title("Messages")
.HeaderTemplate("").Width(70).HtmlAttributes(new { style = "text-align: center;" });
columns.Template(@<text></text>)
.ClientTemplate(@"<input name='name#=ActivityId#' type='radio' value='5' #= ImageStatusId==5 ? checked='checked':'' # /> Received
</br><input name='name#=ActivityId#' type='radio' value='2' #= ImageStatusId==2 ? checked='checked':'' # /> Reviewed - Release to Vendor
</br><input name='name#=ActivityId#' type='radio' value='1' #= ImageStatusId==1 ? checked='checked':'' # /> Reviewed - Do not release to Vendor
</br><input name='name#=ActivityId#' type='radio' value='3' #= ImageStatusId==3 ? checked='checked':'' # /> Rejected")
.HeaderTemplate("Photo Status").Width(240).HeaderHtmlAttributes(new { style = "background-color:white;" }); ;
columns.Bound(p => p.ActivityId).Title("ActivityId").Hidden();
columns.Bound(p => p.ImageId).Title("ImageId").Hidden();
columns.Bound(p => p.ActivityType).Title("ActivityType").Hidden();
columns.Bound(p => p.ReportTag).Title("Report Tag").Width(100).Filterable(false);
columns.Bound(p => p.Question).Title("Store Report Question").Width(200).Filterable(false);
columns.Bound(p => p.Description).Title("Photo Description").Width(200).Filterable(false).HeaderHtmlAttributes(new { style = "background-color:white;" });
columns.Bound(p => p.ReportComments).Title("Report Comments").Width(200).Filterable(false);
columns.Bound(p => p.Answer).Title("Answer").Hidden();
columns.Bound(p => p.SubmissionDate).Title("Submission Date").Format("{0:MM/dd/yyyy hh:mm tt}").Width(140).Filterable(false);
columns.Bound(p => p.Confirmation).ClientTemplate("<a href='../Servicing/ViewServiceReport.aspx?Id=#=Confirmation#' target='_blank'>#=Confirmation#</a>").Title("Confirmation")
.HeaderTemplate("Confirmation").Width(90).Filterable(false);
columns.Bound(p => p.ProjectId).ClientTemplate("<a href='../Servicing/ViewProject.aspx?Id=#=ProjectId#' target='_blank'>#=ProjectNumber#</a>").Title("View Project")
.HeaderTemplate("Project").Width(70).Filterable(false);
columns.Bound(p => p.RmsDistrictId).Title("RmsDistrictId").Hidden();
columns.Bound(p => p.StoreId).ClientTemplate("<a href='../Servicing/ViewStore.aspx?Id=#=StoreId#' target='_blank'>#=StoreDisplay#</a>").Title("View Store")
.HeaderTemplate("Store").Width(70).Filterable(false);
columns.Bound(p => p.ToPortalId).Title("ReviewerId").Hidden();
columns.Bound(p => p.FromPortalId).ClientTemplate("<a href='../Servicing/ViewEmployee.aspx?Id=#=FromRecordId#' target='_blank'>#=FromDisplayName#</a>").Title("View Rep")
.HeaderTemplate("Rep").Width(70).Filterable(false);
columns.Bound(p => p.ColorBox).Title("ColorBox").Hidden();
columns.Template(@<text></text>).ClientTemplate(GetActions().ToString()).HtmlAttributes(new { @class = "menuCell", @style = "width:95px;" }).Width(90);
})
.ToolBar(toolbar =>
{
toolbar.Template(@<text>
<a href="javascript:void(0)" class="k-button k-primary k-button-icontext k-grid-save-changes" title="Save"><span class="k-icon k-i-check"></span>Save</a>
<a href="javascript:void(0)" class="k-button k-button-icontext k-grid-cancel-changes" title="Cancel"><span class="k-icon k-i-cancel"></span>Cancel</a>
<span style="float:right">
Default Photo Status:
@(Html.Kendo().ComboBox()
.Name("defaultStatus")
.BindTo(new List<string>() {
"",
"Reviewed - Release to Vendor"
})
.Events(events => events.Close("onDefaultSelect"))
.SelectedIndex(0)
.Suggest(true)
.AutoWidth(true)
.Deferred(true)
.HtmlAttributes(new { @class = "k-content", style = "width:250px;" })
)
</span></text>);
})
.HtmlAttributes(new { style = "height: 730px;" })
.NoRecords()
.Pageable(pageable => pageable
.Input(true)
.Numeric(false)
.PageSizes(new List<object> { 5, 10, 20, 30, 40, 50 })
)
.Sortable()
.Filterable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("error_handler"))
.Events(events =>
{
events.RequestEnd("onRequestEnd");
})
.Batch(true)
.Model(model =>
{
model.Id(i => i.ActivityId); // Specify the property which is the unique identifier of the model.
model.Field(i => i.ImageId).Editable(false);
model.Field(i => i.Thumbnail).Editable(false);
model.Field(i => i.Question).Editable(false);
model.Field(i => i.Answer).Editable(false);
model.Field(i => i.ActivityType).Editable(false);
model.Field(i => i.SubmissionDate).Editable(false);
model.Field(i => i.ProjectId).Editable(false);
model.Field(i => i.ReportComments).Editable(false);
model.Field(i => i.Confirmation).Editable(false);
model.Field(i => i.RmsDistrictId).Editable(false);
model.Field(i => i.StoreId).Editable(false);
model.Field(i => i.FromPortalId).Editable(false);
model.Field(i => i.ToPortalId).Editable(false);
model.Field(i => i.ProjMgrPortalId).Editable(false);
model.Field(i => i.FromRecordId).Editable(false);
model.Field(i => i.SmallImage64);//.Editable(false);
model.Field(i => i.ToDisplayName).Editable(false);
model.Field(i => i.FromDisplayName).Editable(false);
model.Field(i => i.ProjMgrDisplayName).Editable(false);
model.Field(i => i.ReportTag).Editable(false);
})
.PageSize(20)
.Sort(s =>
{
s.Add("ProjectId").Ascending();
s.Add("SubmissionDate").Ascending();
})
.ServerOperation(false)
.Update(update => update.Action("Update", "AdvPhotoReview").Data("additionalData"))
.Read(read => read.Action("Search", "AdvPhotoReview"))
)
.Editable(editable => editable.Mode(GridEditMode.InCell))
)
@helper GetActions()
{
@(Html.Kendo()
.Menu()
.Name("HoverMenu_#=ActivityId#")
//.Deferred(true)
.Direction(MenuDirection.Right)
.Orientation(MenuOrientation.Vertical)
.Animation(false)
.Items(
items => items.Add().Text("Contact").HtmlAttributes(new { @class = "k-menu-actions" }).Items(
innerItems =>
{
innerItems.Add().Text("Rep").HtmlAttributes(new { onclick = "showContact(event)" });
innerItems.Add().Text("Account Manager").HtmlAttributes(new { onclick = "showUnsubmit(event)" });
}
)
).ToClientTemplate())
}
<script>
function onRequestEnd(e) {
if (e.type == "update") {
var grid = $('#Grid').data('kendoGrid');
var strProjects = getProjects();
grid.dataSource.read({
Store: $('#stores').data('kendoComboBox').value(),
Type: $('#type').data('kendoComboBox').value(),
Rep: $('#rep').data('kendoComboBox').value(),
District: $('#district').data('kendoComboBox').value(),
DateFrom: $('#datefrom').data('kendoDatePicker').value(),
DateTo: $('#dateto').data('kendoDatePicker').value(),
Project: strProjects,
IncludeOutstanding: $('#includeoutstanding').is(':checked'),
ReportTag: $('#reporttag').data('kendoComboBox').value(),
IncludeUnsubmit: $('#includeunsubmit').is(':checked'),
DateType: $('#datetype').data('kendoDropDownList').text()
});
var grid = $("#Grid").data("kendoGrid");
if (grid.dataSource.page() > 1) {
grid.dataSource.page(1);
}
}
}
function additionalData() {
var strProjects = getProjects();
return {
Store: $('#stores').data('kendoComboBox').value(),
Type: $('#type').data('kendoComboBox').value(),
Rep: $('#rep').data('kendoComboBox').value(),
District: $('#district').data('kendoComboBox').value(),
DateFrom: $('#datefrom').data('kendoDatePicker').value(),
DateTo: $('#dateto').data('kendoDatePicker').value(),
Project: strProjects,
IncludeOutstanding: $('#includeoutstanding').is(':checked'),
ReportTag: $('#reporttag').data('kendoComboBox').value(),
IncludeUnsubmit: $('#includeunsubmit').is(':checked'),
DateType: $('#datetype').data('kendoDropDownList').text()
};
}
function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
function onRejectClick(id) {
var comment = document.getElementById("reject.usertext").value;
var includeMaster = 0;
var followupdate = document.getElementById("reject.duedate").value;
var feedbackId = document.getElementById("reject.feedbackId").value;
var templateId = document.getElementById("reject_template").value;
var upload = $("#files").data("kendoUpload"), files = upload.getFiles();
if (files === undefined || files.length == 0) {
var file = "";
}
else {
var file = files[0].name;
}
if (document.getElementById("reject.masterimage").checked) {
includeMaster = 1;
}
if (comment == "") {
document.getElementById('reject.message').innerHTML = "Comment is required";
document.getElementById('reject.messagediv').style.display = 'block';
}
else {
document.getElementById('reject.messagediv').style.display = 'none';
var grid = $("#Grid").data("kendoGrid");
var dataItem = grid.dataSource.get(id);
dataItem.set("Comment", comment);
dataItem.set("FollowUpDate", followupdate);
dataItem.set("FeedbackId", feedbackId);
dataItem.set("TemplateId", templateId);
dataItem.set("RefCompareFile", file);
dataItem.set("IncludeMaster", includeMaster);
var dialog = $("#Main").data("kendoWindow");
dialog.close();
}
}
</script>