Custom validation message Tooltip position not correct for columns

0 Answers 75 Views
Grid
Vivek
Top achievements
Rank 1
Iron
Vivek asked on 09 Aug 2021, 02:02 PM

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 attached the screenshot. It should point to checkbox cell but it is pointing to other column which has value 0.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Vivek
Top achievements
Rank 1
Iron
Share this question
or