I have a grid, I have added custom validations on multiple columns. It's working as expected. But there is one issue, I am not able to edit other cells if there is any validation error on the cell, So first I need to fix the error for this cell then only I am allowed to edit other cells. But I want that it should show the validation error in the tooltip and as well as to edit other cells.
I have attached the tooltip message in the question.
columns.Bound(config => config.X).Title("X").HeaderHtmlAttributes(new { @class = "grid-headercustom" }).
ClientTemplate("#if(data.X == 1)" + "{#<span>Y</span>#}" + "else{#<span>N</span>#}#").
HtmlAttributes(new { @class = "grid-rowcustom" }).HtmlAttributes(new { style = "font-size:12px" }).Filterable(ftb => ftb.Enabled(false));
$.extend(true, kendo.ui.validator, {
rules: {
RateV: function (input, params) {
if (input.is("[name='X']")) {
var grid = $("#mygrid").data("kendoGrid");
var row = input.closest("tr");
var dataItem = grid.dataItem(row);
if (dataItem.X == true && dataItem.Y <= 0) {
input.attr("data-RateV-msg", "X must be greater than zero when the Y is ticked");
return false;
}
}
return true;
}
},
messages: {
RateV: function (input) {
// return the message text
return input.attr("data-val-X");
}
}
});
})(jQuery, kendo);
I have tried to return true also but it doesn't show the error then.
input.attr("data-RateV-msg", "X must be greater than zero when the Y is ticked");
return true;
I have a case where i need to dynamically clone the switch control and use it.
Im able to clone the switch but the script still refers to the original control .
Tried changing the id and name properties but still not able to achieve it .
Can anyone let me know how to do it .(FYI im not using mobileswitch)
Thanks in advance.
Hi,
I have a business requirement to be displayed 100+ bar charts with lines on one page itself while hitting the page.
Can you please help to do that dynamically? I'm very much new to this Kendo UI control.
--
Thanks
Ramesh
I want the sum of two columns to be added to another column in the kendo grid. Now it is showing that NaN when I use ClientTemplate whereas in the case of ClientGroupColumnTemplate shows the correct result. In my case, I want the result in another column instead of a group column any help?
.Columns(c =>
{ c.Bound(p => p.field1).Title("F1");
c.Bound(p => p.field2).Title("F2");
c.Bound(p => p.Total).Title("Total").ClientTemplate("#=calculate(data)#");
})
<script>
function calculate(data) {
field1 + p.field2;
return result;
</script>
Hello,
Could someone provide sample code for export Grid data to excel? below is the requirement:
1. This is MVC project
2. Kendo Grid with many pages in the View.
3. button located in the view but not located in the toolbar section of the Grid.
4. When click button, all Grid data (not just View data) should export to excel file.
Thanks.
Hello,
I try to get dataSource from my MVC project but got syntax error. Could someone tell me what's wrong? Thanks.
Action method on MyController:
public JsonResult Position_Read()
{
var entity = new PositionViewModel
{
POS_ID = "10000",
POS_TYPE="INTER",
CREATE_DT = DateTime.Now
};
return Json(entity);
}
JavaScript in View:
<script>
function GetServerSourceData() {
var ds = new kendo.data.DataSource({
type: "odata",
transport: {
read: "/MySite/MyController/Position_Read"
},
schema: {
model: {
fields: {
POS_ID: { type: "string" },
POS_TYPE: { type: "string" }
CREATE_DT: { type: "date" },
}
}
}
});
return ds;
}
</script>
I have added custom validation on the grid for multiple columns. It's working as expected. The only problem I am facing is that the tooltip position is not pointing to the current cell, it is pointing to different cells in the same row for all columns. How can I fix it?
columns.Bound(config => config.X).Title("X").HeaderHtmlAttributes(new { @class = "grid-headercustom" }).
ClientTemplate("#if(data.X == 1)" + "{#<span>Y</span>#}" + "else{#<span>N</span>#}#").
HtmlAttributes(new { @class = "grid-rowcustom" }).HtmlAttributes(new { style = "font-size:12px" }).Filterable(ftb => ftb.Enabled(false));
$.extend(true, kendo.ui.validator, {
rules: {
RateV: function (input, params) {
if (input.is("[name='X']")) {
var grid = $("#grid-pricefeedconfiguration").data("kendoGrid");
var row = input.closest("tr");
var dataItem = grid.dataItem(row);
if (dataItem.X == true && dataItem.Y <= 0) {
input.attr("data-RateV-msg", "X must be greater than zero when the Y is ticked");
return false;
}
}
return true;
}
},
messages: {
RateV: function (input) {
// return the message text
return input.attr("data-val-X");
}
}
});
})(jQuery, kendo);
I have a checkbox in a grid that I want to conditionally disable. What I have below technically hides the checkbox (haven't figured out how to conditionally 'disable') but you can still click in the box and the checkbox will appear even if it does not meet the condition:
@(Html.Kendo().Grid<SomeUI.Areas.UVL.Models.SomePOModel>
().Name("SomePOgrid")
.Columns(columns =>
{
columns.Bound(p => p.forceClose).Title("Force Close")
.ClientTemplate("#if(status == 'Pending'){# <input id='forceClose' value='#=forceClose#' class='k-checkbox' type='checkbox' checked='checked'/> #}#")
.Width(170).HtmlAttributes(new { style = "text-align:center;" });
})
Hello,
I am using Kendo for Asp.Net MVC. With an ImageBrowser on the Editor control, the name returned from the server (which is different from the file name uploaded) is respected, but for the FileBrowser, the returned name is ignored. How does on get this to work?
<PackageReferenceInclude="Telerik.UI.for.AspNet.Core"Version="2021.2.616"/>