Telerik Forums
Kendo UI for jQuery Forum
2 answers
35 views
I have a lot of projects with kendo grids in them. As a matter of practice, I always call the same function on the dataBound event. Instead of adding this every time I initialize a widget, I would like to set it as a default so that any time I initialize a kendo grid, it is already set. I don't want to give up the ability to add additional functions to specific grids though. Is this possible? 
Rizwan
Top achievements
Rank 1
Iron
 updated answer on 16 Aug 2025
2 answers
100 views
I have a kendo  grid which is having a row template specified. I have enabled 'incel' editing on it. It's displaying the dirty icon correctly  when a cell is edited only when I'm not using the row template.
jsFiddle  
Dave
Top achievements
Rank 1
Iron
 answered on 22 Jun 2025
1 answer
49 views

Hello

I have a grid and each row can be expanded, using detailInit, to show an inner grid. 

I fetch the data beforehand so that I can populate the grid using local data.

In inner grid I have a column with a delete button  - using template I call a delete function passing this as a parameter.



// column definition
 {
                    field: "delete",
                    title: "Delete",
                    width: 50,
                    template: "<span class='delete' onclick='delete(this)'><img src='.delete_icon.png'/></span>"
},

my delete function :


function delete(e) {
            let Loader = KENDO.KendoLoader($("body"));
            try {
                Loader.Show();
                let row = $(e).closest("tr");
                let grid = $(e).closest(".innerGrid");

                let dataItem = KENDO.KendoGrid(grid).GetDataItem(row);
                let innerRowId= dataItem.id;

                let parentRow = row.parent().closest(".k-detail-row").prev();
                let parentDataItem = KENDO.KendoGrid($("#ParentGrid")).GetDataItem(parentRow);

                KENDO.KendoGrid(grid).DeleteUI([innerRowId]); // DeleteUI gets array of ids to delete , implemented below
               
                // if no rows remain in inner grid, I need to update a column's value in the parent row
                if (KENDO.KendoGrid(grid).HasRows() == false) {
                    grid.hide();
                    grid.siblings(".noRecordsFound").show();

                     let updatedDataObj = {
                            id: parentDataItem.id,
                            someColumnOnParentRow: null
                        }

                        KENDO.KendoGrid($("#ParentGrid")).UpdateUI([updatedDataObj]); // UpdateUI gets array of objects to update, implemented below
                }
            }
            catch (error) {
                debugger;
                console.log(error.message);
            }
            finally {
                Loader.Hide();
            }
        }

We have created a own KENDO wrapper script for different widgets. Here is the kendoGrid code: 


let KENDO = {
  KendoComponent(jQueryElement, component, options = null) {

        let kendoComponent = {};

        kendoComponent.InitKendoComponent = function () {
            let kComponent = jQueryElement.data(component);
            if (!kComponent) {
                if (options) {
                    kComponent = jQueryElement[component](options).data(component);
                }
                else {
                    kComponent = jQueryElement[component]().data(component);
                }
            }
            return kComponent;
        };

        return kendoComponent;
    },

   KendoGrid(jQueryElement, options = null) {

        let kendoGrid = {};

        let kGrid = KENDO.KendoComponent(jQueryElement, "kendoGrid", options).InitKendoComponent();
        if (options)
            kGrid.setOptions(options);

        kendoGrid.SetOptions = function (options) {
            kGrid.setOptions(options);
            return kendoGrid;
        }

        kendoGrid.GetData = function () {
            return Array.from(kGrid.dataSource.data());
        }

        kendoGrid.GetDataItem = function (jQueryTableRow) {
            return kGrid.dataItem(jQueryTableRow);
        }

        kendoGrid.UpdateUI = function (dataToUpdate = []) {
            dataToUpdate.forEach(obj => {
                let dataItem = kGrid.dataSource.get(obj.id);
                if (dataItem) {
                    for (let prop in obj) {
                        if (prop !== "id") {
                            dataItem.set(prop, obj[prop]);
                        }
                    }
                } 
            });
            return kendoGrid;
        }

        kendoGrid.DeleteUI = function (idsToDelete = []) {
            idsToDelete.forEach(id => {
                let dataItem = kGrid.dataSource.get(id);
                if (dataItem)
                    kGrid.dataSource.remove(dataItem);
            });
            return kendoGrid;
        };

        kendoGrid.HasRows = function () {
            return kGrid.dataSource.data().length > 0;
        }

        return kendoGrid;
    }
  
}

It appears that UpdateUI does not function as it should.

When I test I notice that when the last remaining row of inner grid is deleted, the parent row's column is indeed updated to null, the No Records Found message is shown instead of the inner grid, the parent row gets collapsed, and when I expand it the inner grid is shown with the last remaining row.

Suprisingly, if I comment out the UpdateUI line, the inner grid's row gets deleted, without collapsing the inner grid and the No Records Found message is shown as intended (the parent row's column does not get updated in this case, obviously).

Is it a bug in Kendo ? or am I doing something wrong?

Neli
Telerik team
 answered on 13 Jun 2025
1 answer
31 views

For certain types of data in my grid, I need to define custom filter operators, e.g.:

updateOrAddFilter(fieldKey, {
    field: fieldKey, operator: function (item) {
        const nItem = normalize(item);
        const nValue = normalize(value);

        return nItem && nItem.includes(nValue);
    }
});

The updateOrAddFilter function then browses through the all the filters currently applied to the grid's dataSource, replaces old current-column filters with the new one and keeps all the other-column ones, and updates the grid's dataSource as such:

grid.dataSource.filter({ logic: "and", filters: updatedFilters });

The problem is that - it doesn't work! The updateOrAddFilter function works exactly as expected until I try to combine the custom operator filter with others.

Why is this happening? How can I fix it? Thanks in advance.
Martin
Telerik team
 answered on 11 Jun 2025
1 answer
30 views

I've seen your demos on setting up the type: "date" and the format: stuff on the model and on the column display for the grid.  Your demo sorts the dates as if they are dates properly.  Ours shows the value as null if we set the type to date.  It displays the string properly if we set it to type string but still sorts as a string.  If we simply set the column to the kendo format and do not use a schema on the datasource, our code still sorts as a string.

https://dojo.telerik.com/TgCibbiL

When I looked at the data in your demo, it looks like the long form GMT.  Today, we are instead blocking the script from sending the .NET property types of DateTime and instead sending a pre-formatted string of the date.  Ran into some serialization issues when posting those same objects with DateTime properties on them.

Are you returning your DateTime properties as strings but formatted in this GMT when you serialize your .NET data objects back to the JavaScript handlers?

Martin
Telerik team
 answered on 22 May 2025
1 answer
100 views

Module Bundlers - Kendo UI Third-Party Tools - Kendo UI for jQuery

The module bundlers page references Vite as an example which leads me to believe that it can be used with Kendo.

However even this basic example doesn't appear to work: https://stackblitz.com/edit/vitejs-vite-i842ucun?file=src%2Fmain.js

Am I doing something wrong?

Hui Chuan
Top achievements
Rank 1
Iron
 answered on 21 May 2025
1 answer
40 views
I've got a grid that uses a Kendo Wizard in the grid edit popup window.  The first step in the wizard has 3 AutoComplete controls (among other controls).  The first 2 AutoCompletes do not save the value selected back to the model and grid, but the 3rd one does and they're all configured exactly the same.  The code was working before we upgraded to 2024.3.806.  Are there breaking changes for the wizard or AutoComplete in this release?  A demo for this kind of scenario would be helpful because I inherited this code, and I'm not even sure if it was done correctly.  Here is a sample of the js that defines the grid and the wizard (in the grid edit method):

    $gridDiv.kendoGrid({
        autoBind: true,
        columns: [
            {
                field: "DealNumber",
                title: "Deal Number",
                filterable: {
                    extra: false,
                    operators: {
                        string: { contains: "contains" }
                    }
                },
                sortable: true,
                template: 'dealUrl',
                editable: () => false
            },
            {
                field: "CustomerName",
                title: Customer Name",
                filterable: {
                    extra: false,
                    operators: {
                        string: { contains: "contains" }
                    }
                },
                sortable: true
            },
            {
                field: "SalesPersonName",
                title: "Sales Person",
                filterable: {
                    extra: false,
                    operators: {
                        string: { contains: "contains" }
                    }
                },
                sortable: true
            },
            {
                field: "CreatedDate",
                type: "date",
                title: "Created Date",
                sortable: true,
                filterable: true,
                format: "{0: M/d/yyyy}",
                width: 100,
                editable: function () { return false; }
            }
        ],
        editable: {
            mode: "popup",
            window: {
                title: "Add/Edit",
                width: "500px"
            }
        },
        edit: function (e) {
            const popupWindow = e.container.data("kendoWindow");
            popupWindow.center();

            let model = e.model;

            $(e.container).kendoWizard({
                pager: true,
                done: function (e) {
                    e.preventDefault();

                    $gridDiv.dataSource.sync();

                    $($(".k-popup-edit-form")[0]).data("kendoWindow").close();
                },
                reset: function (e) {
                    e.preventDefault();

                    $gridDiv.cancelChanges();

                    $($(".k-popup-edit-form")[0]).data("kendoWindow").close();
                },
                steps: [
                    {
                        title: "Sale Info",
                        buttons: [{
                            name: "next",
                            primary: true,
                        },
                        {
                            name: "reset",
                            text: "Cancel"
                        }],
                        form: {
                            id: "page1",
                            orientation: "vertical",
                            formData: model,
                            items: [

                                {
                                    field: "CustomerName",
                                    title: "Customer Name",
                                    editor: "AutoComplete",
                                    editorOptions: {
                                        dataSource: {
                                            serverFiltering: true,
                                            transport: {
                                                read: {
                                                    url: "/Customer/Search",
                                                    dataType: "json",
                                                    type: "POST"
                                                },
                                                parameterMap: (options, operation) => {
                                                    return {
                                                        text: (options.filter.filters[0] !== void 0) ?
                                                            options.filter.filters[0].value :
                                                            null
                                                    };
                                                }
                                            }
                                        },
                                        dataTextField: "FullName",
                                        minLength: 3,
                                        highlightFirst: true,
                                        suggest: true,
                                        valuePrimitive: true,
                                        select: (e) => {
                                            model.set("CustomerId", e.dataItem.Id);
                                        },
                                        enforceMinLength: true,
                                        filter: 'contains'
                                    }

                                },
                                {
                                    field: "CustomerId",
                                    title: "Customer Id",
                                },
                                {
                                    field: "SalesPersonName",
                                    title: "Sales Person",
                                    editor: "AutoComplete",
                                    editorOptions: {
                                        dataSource: {
                                            serverFiltering: true,
                                            transport: {
                                                read: {
                                                    url: "/SalesPerson/Search",
                                                    dataType: "json",
                                                    type: "POST"
                                                },
                                                parameterMap: (options, operation) => {
                                                    return {
                                                        text: (options.filter.filters[0] !== void 0) ?
                                                            options.filter.filters[0].value :
                                                            null
                                                    };
                                                }
                                            }
                                        },
                                        dataTextField: "FullName",
                                        template: '#: data.FullName #',
                                        minLength: 3,
                                        highlightFirst: true,
                                        suggest: true,
                                        valuePrimitive: true,
                                        select: (e) => {
                                            model.set("SalesPersonId", e.dataItem.Id);
                                        },
                                        enforceMinLength: true,
                                        filter: 'contains'
                                    }

                                },
                                {
                                    field: "Manager",
                                    title: "Manager",
                                    editor: "AutoComplete",
                                    editorOptions: {
                                        dataSource: {
                                            serverFiltering: true,
                                            transport: {
                                                read: {
                                                    url: "/Manager/Search",
                                                    dataType: "json",
                                                    type: "POST"
                                                },
                                                parameterMap: (options, operation) => {
                                                    return {
                                                        text: (options.filter.filters[0] !== void 0) ?
                                                            options.filter.filters[0].value :
                                                            null
                                                    };
                                                }
                                            }
                                        },
                                        dataTextField: "FullName",
                                        template: '#: data.FullName #',
                                        minLength: 3,
                                        highlightFirst: true,
                                        suggest: true,
                                        valuePrimitive: true,
                                        select: (e) => {
                                            model.set("ManagerId", e.dataItem.Id);
                                        },
                                        enforceMinLength: true,
                                        filter: 'contains'
                                    }

                                }

                            ]
                        }
                    },
                    {
                       //step 2 code here//
                    },

                ]
            })
        },
        sortable: true,
        resizable: true,
        pageable: {
            pageSizes: false,
            messages: {
                empty: ""
            }
        },
        filterable: true,
        persistSelection: true,
        noRecords: true,
        messages: {
            noRecords: "No records found"
        },
        dataSource: gridDataSource(),
    }).data("kendoGrid");
},
Paul
Top achievements
Rank 1
Iron
 answered on 13 May 2025
0 answers
27 views

When you touch-drag the grid, it doesn't look good if you move it diagonally. It's confusing. It looks distracting. What if you only want it to move up and down, or left and right?

Isn't there a very simple code?

Thank you.

 

 

n/a
Top achievements
Rank 1
Iron
Iron
 asked on 08 May 2025
1 answer
33 views

Expected:

When a scrollable grid has loaderType = 'skeleton', and when a user clicks sort on a column, the scroll bar will not move.

Actual:

The scrollbar resets to the beginning.

 

Code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Kendo UI Snippet</title>

    
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2025.1.227/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/themes/10.2.0/default/default-ocean-blue.css">
<script src="https://unpkg.com/jszip/dist/jszip.min.js"></script>
</head>
<body>
  
<div id="grid"></div>
<script>
// The dataSource is initialized as a stand-alone widget that can be bound to the Grid.
var dataSource = new kendo.data.DataSource({
  transport: {
    read: {
      // The remote endpoint from which the data is retrieved.
      url: "https://demos.telerik.com/kendo-ui/service/products",
      dataType: "jsonp"
    }
  },
  pageSize: 10
});

$("#grid").kendoGrid({
  // The dataSource configuration is set to an existing DataSource instance.
  dataSource: dataSource,
  pageable: true,
  columns: [
    {width: 500, field: 'ProductID' },
    {width: 500, field: 'ProductName' },
    {width: 500, field: 'UnitPrice' },
    {width: 500, field: 'UnitsInStock' },
    {width: 500, field: 'Discontinued' },
    {width: 500, field: 'test' }
  ],
  scrollable: true,
  sortable: true,
  loaderType: "skeleton",
});
</script>
</body>
</html>

Dojo: https://dojo.telerik.com/gmdqkCcS

 

Is there a fix/workaround for this?

Neli
Telerik team
 answered on 08 May 2025
1 answer
41 views

Hello,

I'm trying to export a grid into a excel file with images but it's not working in 2024 version.

I had a 2022 version before and it was working, but upgrading for 2024.4.1112 it no longer works. It shows an error "The file wasn't available on site"

The example from https://dojo.telerik.com/RWscVNYF doesn't work. 

 

Can you please help?

Thank you.

Helena
Top achievements
Rank 1
Iron
 answered on 29 Apr 2025
Narrow your results
Selected tags
Tags
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
Date/Time Pickers
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
SPA
Filter
Drawing API
Drawer (Mobile)
Globalization
Gauges
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
OrgChart
TextBox
Effects
Accessibility
ScrollView
PivotGridV2
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
Popover
DockManager
FloatingActionButton
TaskBoard
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?