I am trying to apply the filter for a column that has null values in the database. When I try to filter the column by some value, it throws following error. Please suggest the solution to handle columns those have null values in the database
An exception of type 'System.NullReferenceException' occurred in System.Core.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object
Anyone know if offlineStorage would let users scroll through previous pages that were loaded via virtual scrolling? Can they come back to a page that was closed and see their cached data? Is there a feature that would allow this?
I created a grid with detail rows. Detais rows may have unsaved data. In that case I need to stop the collapse event. My code is not working:
var detailGrid = $("#grid-details").kendoGrid({
detailTemplate: getDetailTemplate,
detailInit:InitFunc,
detailCollapse: function (e) {
if (.....here I check for changes ) {
e.preventDefault();
return false;
}
},
......});
I got to e.preventDefault(), but the row is collapsed anyway
I was wondering how to hide/show columns based on the values of aggregate values in footer. For example:
@(Html.Kendo().Grid<Payroll.Models.PayrollAuthorizationByDepartmentModel>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(dataSource => dataSource.EmployeeId).Title("Emp. No");
columns.Bound(dataSource => dataSource.EmployeeNameForDisplay).Title("Emp. Name");
columns.Bound(e => e.RegHours).Title("Reg.")
.ClientFooterTemplate("<div style='text-align: right'> \\#= kendo.toString(sum, '0.00')\\# </div>")
.ClientTemplate("\\#= kendo.toString(RegHours, '0.00')\\#");
columns.Bound(e => e.OTHours).Title("OverTime 1.5")
.ClientFooterTemplate("<div style='text-align: right'> \\#= kendo.toString(sum, '0.00')\\# </div>")
.ClientTemplate("\\#= (OTHours==0)? '':kendo.toString(OTHours, '0.00')\\#");
})
.DataSource(dataSource => dataSource
.Ajax()
.Aggregates(aggregates =>
{
aggregates.Add(e => e.RegHours).Sum();
aggregates.Add(e => e.OTHours).Sum();
})
.Read(read => read.Action("AuthorizationByEmployee_Read", "Authorize", new { locationId = @ViewBag.LocationId, departmentId = "#=DepartmentId#", startDate = @ViewBag.StartDate, endDate = @ViewBag.EndDate }))
.ServerOperation(false)
.Sort(sort => sort.Add("EmployeeFirstName").Ascending())
)
.Sortable()
.Events(events => events.DataBound("onDataBoundOfChildGrid"))
.ToClientTemplate()
)
How to hide the column if the sum is 0?
Thanks!
I am having some trouble with a simple bar chart.
Here is my model
public class PrivateReportCardCumulativeInvestments{ public int FUND_INT { get; set; } public int YearCategory { get; set; } public decimal Commitments { get; set; } public decimal Distributions { get; set; } public decimal Draw_Down { get; set; } public decimal Fees { get; set; } public PrivateReportCardCumulativeInvestments() { }}
And here is my Chart.
@(Html.Kendo().Chart<BetaSMTRApp.Business.PrivateReportCardCumulativeInvestments>()
.Name("ChartInvestmentCumulations_" + item.FUND_INT.ToString())
.Title("Cumulative Investments")
.DataSource(dataSource => dataSource
.Read(read => read.Action("GetCumulativeInvestments", "PrivateReportCard", new { fundInt = item.FUND_INT }))
)
.Series(series =>
{
series.Column(model => model.Commitments).Name("Commitments");
series.Column(model => model.Distributions).Name("Distributions");
series.Column(model => model.Draw_Down).Name("DrawDowns");
series.Column(model => model.Fees).Name("Fees");
})
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.ValueAxis(axis => axis.Numeric()
.Labels(labels => labels
.Format("${0}")
.Skip(2)
.Step(2)
)
)
.CategoryAxis(axis => axis
.Categories(model => model.YearCategory)
.Labels(labels => labels.Format("yyyy"))
)
)
Looking for the following result
Vertical Axis (value of the following)... model.Commitments, model.Distributions, model.DrawDown, Model.Fees (values are between 0 and 3 as a decimal with 1 precision.
Horizontal Axis (model.YearCategory)
Bars -- Commitment, Distribution, DrawDown and Fees.
Example of data
YearCategory Commitments Distributions Draw_Down Fees2004 71.5 36.5 0 0.52005 35.8 50.6 6.4 22006 0 90.9 28 42007 0 111.7 43.2 5.72008 0 110.4 50.5 8.12009 0 113 59.3 9.82010 0 113.7 81.2 11.22011 0 111 88.3 12.72012 0 74.6 146.4 142013 0 76.5 153.6 15.12014 0 41.9 252 16.3Any ideas of what i am missing?
Thanks
Corey
I want to open a kendo window when click in kendo grid cell. The code is
columns.Bound(s => s.HasComments)
.HeaderHtmlAttributes(new { title = "Comments"})
.ClientTemplate("<div class='sprite sprite-note' onclick='openCommentWindow('ResourceSport', '<#= ResourceSportId #>', '<#= SportName #>', '" + Model.Editable + "', 'true');'></div>")
.Width(100);
openCommentWindow is jquery function. But onclick does not respond at all. I want to know what is the problem and how to do this. Thanks.
Hi!
I would like to say that i have already read similiar
topics in this forum and none of them solved my problem. When im trying
to access dynamically created window data("kendoWindow") the result is
undefined :/
So i've got a "Contractors" View which got almost nothing inside it, besides kendo Grid and few buttons + this placeholder:
<div id="editContractorNaturalPersonWindow"></div>When a user clicks the button, window is opened:
$(".contractorNaturalPerson").click(function () { var dataUrl = $(this).data("url"); $("#editContractorNaturalPersonWindow").kendoWindow({ content: { title: "title123", url: dataUrl }, open: function () { kendoWindow_center("#editContractorNaturalPersonWindow"); }, refresh: function () { kendoWindow_center("#editContractorNaturalPersonWindow"); } }); var dialog = $("#editContractorNaturalPersonWindow").data("kendoWindow"); dialog.open(); });
Till now everything works, window is being opened, centered, etc. Inside dynamically loaded "EditContractorNaturalPerson" Partial View i've got a simple form with few textboxes and this script:
$('.editContractorNaturalPersonForm').submit(function () { if ($(this).valid()) { $.ajax({ url: this.action, type: this.method, data: $(this).serialize(), success: function (data) { if (data.result == "Success") { debugger; var dialog = $("#editContractorNaturalPersonWindow").data("kendoWindow"); dialog.close(); $('#contractorsGrid').data('kendoGrid').dataSource.read(); return false; } else if (data.result == "Error") { debugger; for (prop in data.modelErrors) { if (data.modelErrors[prop].length > 0) { $("#" + prop).next().text(data.modelErrors[prop]); } } } }, error: function (xhr, ajaxOptions, thrownError) { alert("EditContractorNaturalPerson-AjaxError"); } }); } return false; });
This line:
var dialog = $("#editContractorNaturalPersonWindow").data("kendoWindow");Gives me undefined, EVEN THAT jQuery found this object:
$("#editContractorNaturalPersonWindow")I already tried to remove window by destroying this jquery object (k-window) but it breaks its functionality. What can i do ? Please help :)