Allow using kendo templates in columns.attributes for example
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
columns: [ {
field: "name",
title: "Name",
attributes: {
"data-id": "#:data.id#",
"data-clientid": "#:data.clientId#",
}
} ],
dataSource: [ { id:1, name: "Jane Doe", clientId:"#223" }, { id:2, name: "John Doe", clientId:"#354" }]
});
</script>Hi
again this request is not urgent as I implemented this myself.
I'd like to have 'nextRecord' 'previousRecord' functionality in the grid widget.
We have a next/previous record button on our forms and as floating buttons to navigate the records.
As soon as we navigate to the next/previous record, the form loads the data of the concerning record.
My current implementation is as follows:
/**
*
* Grid with navigation code included
*
* selectRowByIndex: 0 based row selection by index of currently shown rows
*
* @author Alex Bernhard <alex.bernhard@uzh.ch>
* @version 1.2.0
*/
(function ($) {
var kendo = window.kendo,
ui = kendo.ui,
Grid = ui.Grid,
self = this;
var NavigatableGrid = Grid.extend({
init: function (element, options) {
// assign that to this
var self = this;
this.selectedIndex = 0;
this.updateAfterLoad = false;
// call the base function to create the widget
Grid.fn.init.call(this, element, options);
if (typeof options['updateMethod'] == 'function') {
this.updateMethod = options['updateMethod'];
}
self.bindEvents();
},
options: {
name: "NavigatableGrid",
},
bindEvents: function () {
this.bind("change", function () { this.setSelectedIndex(); });
this.bind("dataBound", function () {
this.selectRowByIndex(this.selectedIndex);
// after selecting the next row, shall update be called here?
// happens only when navigating to a new page
// or after search results are present
if (this.updateAfterLoad) {
this.updateAfterLoad = false;
let selectedItem = this.dataItem(this.select());
if(selectedItem != null && selectedItem.hasOwnProperty('id')){
this.updateMethod(selectedItem.id);
}
}
return false;
});
},
updateMethod: function () { },
setSelectedIndex: function () {
let dataRows = this.items();
this.selectedIndex = dataRows.index(this.select());
return this.selectedIndex;
},
selectRowByIndex: function (index) {
// zero based index
this.clearSelection();
this.select('tr:eq(' + index + ')');
},
selectRowById: function (id) {
this.clearSelection();
let view = this.dataSource.view();
let _self = this;
let rows = $.grep(view, function (item) {
return item.id == id;
}).map(function (item) {
return _self.tbody.find("[data-uid=" + item.uid + "]");
});
if (Array.isArray(rows) && typeof rows[0] !== 'undefined') {
this.select(rows[0]);
}
},
previousRow: function () {
// get current number of rows
let pageSize = this.dataSource.pageSize();
let currentPage = this.dataSource.page();
// already first row of current page ?
if (this.selectedIndex == 0) {
let previousPage = currentPage - 1;
// not the first page yet - load the previous page and read the data
// after load
if (previousPage > 0) {
this.selectedIndex = pageSize - 1; // last row of previous page
this.updateAfterLoad = true;
this.dataSource.page(previousPage);
}
} else {
// set next row index (0 based !!)
this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
this.selectRowByIndex(this.selectedIndex);
this.updateAfterLoad = false;
let selectedItem = this.dataItem(this.select());
if(selectedItem != null && selectedItem.hasOwnProperty('id')){
this.updateMethod(selectedItem.id);
}
}
},
nextRow: function () {
// get current number of rows
let numRows = this.items().length;
let pageSize = this.dataSource.pageSize();
let numPages = this.dataSource.totalPages();
let currentPage = this.dataSource.page();
// already last row of current page ?
if (this.selectedIndex == numRows -1) {
let nextPage = currentPage + 1;
// not the last page yet - load the next page and read the data
// after load
if (nextPage <= numPages) {
this.dataSource.page(nextPage);
this.selectedIndex = 0;
this.updateAfterLoad = true;
}
} else {
// set next row index (zero based !!)
this.selectedIndex = Math.min(this.selectedIndex + 1, pageSize-1);
this.selectRowByIndex(this.selectedIndex);
let selectedItem = this.dataItem(this.select());
if(selectedItem != null && selectedItem.hasOwnProperty('id')){
this.updateMethod(selectedItem.id);
}
}
}
});
kendo.ui.plugin(NavigatableGrid);
})(jQuery);
And an example usage is like:
accessionGrid = $("#accession-grid").kendoNavigatableGrid({
.... standard code for kendo grid
// call method in form when navigating
updateMethod: function(data){accessionForm.update(data)},
.....
});
// code for grid navigation
function nextAccessionGridRow(){
accessionGrid.nextRow();
}
function previousAccessionGridRow(){
accessionGrid.previousRow();
}When filtering is enabled in the Grid, the autoFitColumns method does not work.
The filterable Grid's columns are not auto-fitted
The filterable Grid's columns should be auto-fitted
In an in-cell edit mode, if you edit a Grid cell with enter key, the Grid will scroll to the top.
Regression introduced with v2020.3.1021
The Grid scrolls to the top
The Grid shouldn't scroll to the top.
The Grid column header texts collides with the columnMenu icons.
Regression introduced with 2023.1.314
The column header text overlaps with the menu icon
the header text shouldn't collide with the menu icon
Clicking on a custom icon-button command in the Grid fires a change event.
This is a regression introduced with v 2023.2.606
custom command button - only the click handler is executedOnly the click handler should be executed on click of an icon button representing a custom command.
Bug report
When tabbing through the row filter inputs of a virtual Grid only headers are scrolling
Reproduction of the problem
Run this Dojo - https://dojo.telerik.com/IjuJoRAx/5
Expected/desired behavior
Headers and columns shall scroll when tabbing through the row filter inputs
Environment
Kendo UI version: [all]
jQuery version:[all]
Browser: [all ]
Test Environment:
OS: Windows 11 Version 22H2(OS build 22621.1992)
Browser: Edge browser version 115.0.1902
Screen Reader: Narrator.
Repro Steps:
Actual Result:
Incorrect role defined as "link" for the "Metric type filter column setting" button.
Expected Result:
Correct role defined as "link" for the "Metric type filter column setting" button.
In the draggable Grid, after new items are created the dragging of the rows does not work as expected.
Sometimes the rows can not be moved at all, sometimes it is dropped in the wrong place.
The rows should be dragged and dropped without any issue even after creating new items in the Grid.
When PivotConfiguratorV2 and Grid are configured on the same page and sortable and/or filterable are enabled for both components an error is thrown in the console when trying to filter.
The following error is thrown in the console:
Uncaught TypeError: Cannot read properties of undefined (reading 'close')
There should be no error in the console and it should be possible for both PivotConfiguratorV2 and Grid to be sortable and filterable.
When the scrollable option of the Grid is set to "virtual: 'columns'", the reordering of the columns cannot be performed while dragging over the field headers.
Regression introduced with 2022.3.913
The columns cannot be reordered from the field headers. Instead, the field headers are flickering.
Screen recording - https://screenpal.com/watch/c0jrQ2Vpr8e
If the reordering is performed below the headers, it works properly.
Should be able to reorder the columns from the field headers without flickering.
Bug report
Download Builder Tool does not add all dependencies for Grid
Reproduction of the problem
Download Builder Tool does not add Chip and ChipList as dependencies that are needed when grouping is enabled.
Expected/desired behavior
Al dependencies shall be added to the Grid
Environment
Kendo UI version: [all]
Browser: [all]
When culture different than 'en-..' is set in Grid the validation.min for the Date field is not taken into account.
In case a culture different than 'en-..' is selected the min value for the DatePicker is not applied.
The min value should be set for the DatePicker no matter of the culture.
edit: function(){
$('[data-role="datepicker"]').data("kendoDatePicker").setOptions({ min: new Date()})
},
When the value of a cell in the Grid is set using the model.set method, and there is already a dirty cell in the Grid, the .k-dirty-cell class is added to multiple cells.
setValue button (The set value button is setting the value of the third cell in the ProductName column using the API set method)The k-dirty-cell class is applied to multiple cells (the background is changed to green).
The .k-dirty-cell class should be applied only to the cells with changed value.
Bug report
Grid with ColumnMenu groups in combination with multi-column headers gives an error:
kendo.all.js:326079 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
Reproduction of the problem
Dojo: https://dojo.telerik.com/EtEQeBIy
Expected/desired behavior
ColumnMenu groups shall work together with multi-column headers
Environment
Kendo UI version: [all]
Browser: [all]
When a column is unsticked either through the built-in context menu or through the unstickColumn method all the casses from the cells in that column are removed, even the 'k-table-td' class.
All classes in that column are removed
<td class="" style="" role="gridcell">Boulevard Tirou, 255</td>
Note: Initially the cells have the k-table-td class twice which is also not expected
<td class="k-grid-content-sticky k-table-td k-table-td" style="left: 0px; right: 0px;" role="gridcell">Boulevard Tirou, 255</td>
Only the 'k-grid-content-sticky' class should be added or removed when sticking/unsticking a column.
When there is a sticky column in Grid and the column is unsticked, it can not be dragged for reordering.
The column can not be dragged and reordered
It should be possible to reorder the column after it is unsticked.
Bug report
copySelectionToClipboard() throws an error when the Grid has hidden column/s
Also if false is passed to the method - grid.copySelectionToClipboard(false); - not all GUID columns are copied to the clipboard
Reproduction of the problem
Dojo: https://dojo.telerik.com/OpiBoDaH
Select a row/rows
Click on the Select and copy button
Expected/desired behavior
Error should not be present and copy to clipboard shall copy correct data
Environment
Kendo UI version: [all]
Browser: [all]
When all columns have set width in pixels resizing of the columns does not work as expected and the cursor is not aligned with the columns.
The column becomes much wider and the cursor is not aligned with the column border - screencast - https://somup.com/c0lqlFkjLc
The column should be resized along with the movement of the cursor.
Note: The issue starts to appear with Kendo version 2023 R2 SP1 (2023.2.718). Before this version the issue was reproducible only when the pixels are mentioned in the width setting - example: { field: "name", width: "20px" }, - Dojo - https://dojo.telerik.com/@NeliKondova/IdEsagig