Hi to all,
I have an issue regarding the resizing feature on a gridview, when I'm trying to resize any column, the code break with this message :
Unhandled exception at line 48, column 27944 in http://localhost:54998/Scripts/kendo/2016.2.714/kendo.all.min.js
0x800a138f - JavaScript runtime error: Unable to set property 'width' of undefined or null reference
on those lines :
resizeend: function () { var newWidth = th.outerWidth(), column, header; cursor(that.wrapper, ''); if (browser.webkit) { that.wrapper.removeClass('k-grid-column-resizing'); } if (columnWidth != newWidth) { header = that.lockedHeader ? that.lockedHeader.find('thead:first tr:first').add(that.thead.find('tr:first')) : th.parent(); var index = th.attr(kendo.attr('index')); if (!index) { index = header.find('th:not(.k-group-cell):not(.k-hierarchy-cell)').index(th); } column = leafColumns(that.columns)[index]; column.width = newWidth; /* <--- WHERE IT BREAKS*/ that.trigger(COLUMNRESIZE, { column: column, oldWidth: columnWidth, newWidth: newWidth }); that._applyLockedContainersWidth(); that._syncLockedContentHeight(); that._syncLockedHeaderHeight(); } that._hideResizeHandle(); th = null;}
And here is the code of the grid :
@(Html.Kendo().Grid(Model)
.Name("mainGrid")
.Columns(columns =>
{
//// Column binding
//// First three columns are locked
columns.Bound(c => c.Article).Width(70).Locked(true).Lockable(false);
columns.Bound(c => c.ParagraphNb).Title("Paragraph").Width(90).Locked(true).Lockable(false);
columns.Bound(c => c.CircularSName).Title("Legislation short name").Width(180).Locked(true).Lockable(false)
.ClientTemplate("#=generateNameTemplate('Document', 'SN', CircularSName, false, data.UnderReview)#"); // Template based column to generate link toward Documnets
columns.Bound(c => c.CircularLName).Title("Legislation long name").HtmlAttributes(new { @class = "multiline-cell" }).Width(300);
columns.Bound(c => c.EntitiesNameList).ClientTemplate("#=generateEntitiesTemplate(Entities)#").Width(150).HtmlAttributes(new
{
@class = "multiline-cell"
});
columns.Bound(c => c.EntitiesIdList).Hidden(); // Entities list column is used for filtering purposes only and is hidden (list of Guids)
columns.Bound(c => c.Section).Width(200);
columns.Bound(c => c.FullText).Title("Full text").ClientTemplate("<div class='fulltext-cell'> #if (data.UnderReview) " +
"{# " +
"<span class='under-review'> Full Text is unavailable until the paragraph is published. </span>" +
"#} " +
"else if (data.IsRepealed) " +
"{# " +
"<span class='repealed-disclaimer'> This paragraph has been repealed </span>" +
"#}" +
"else" +
"{# " +
" #=data.FullText #" +
"#}#" +
"</div>")
.HtmlAttributes(new { @class = "multiline-cell" })
.Width(600);
columns.Bound(c => c.Category).Width(150);
columns.Bound(c => c.MainTopic).Width(125);
columns.Bound(c => c.SubTopic1).Title("Other topic 1").Width(125);
columns.Bound(c => c.SubTopic2).Title("Other topic 2").Width(125);
columns.Bound(c => c.ObligationTitle).Title("Obligation title").Width(200);
columns.Bound(c => c.ObligationDrafted).Title("Obligation Text").HtmlAttributes(new { @class = "multiline-cell" }).Width(345);
columns.Bound(c => c.LogicLinks).Width(250).ClientTemplate("#=generateLinksTemplate(data.LogicLinks)#"); ;
columns.Bound(c => c.Information).Title("Administration comments").HtmlAttributes(new { @class = "multiline-cell" }).Width(350);
columns.Bound(c => c.ShortEntryDate).Title("Entry in force date").Width(160).Format("{0:dd/MM/yyyy}");
columns.Bound(c => c.Order).Title("Order in Legislation");
columns.Bound(c => c.Id).ClientTemplate("<button class='editButton' onclick='editParagraph(\" #=data.Id #\");'>Edit</button>").Title("").Width(60);
})
.Scrollable(scrollable => scrollable.Height(540))
.Resizable(resizable => resizable.Columns(true))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(new[] { 25, 50, 100 })
.ButtonCount(5)
)
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Read", "Paragraph"))
.PageSize(25)
.ServerOperation(true)
.Sort(s =>
{
s.Add("CircularSName").Ascending();
s.Add("Order").Ascending();
})
)
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Multiple))
// Eport Excel
.Excel(excel => excel
.FileName(string.Format("Paragraphs_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")))
.Filterable(true)
.AllPages(true)
.ForceProxy(true)
.ProxyURL(Url.Action("ExportExcel", "Paragraph"))
))
Can you help me to understand this and how to fix it ?
Cheers !

Hi there,
Im creating a kendoScheduler that retrieves events for a specific user, see below code (shortened for brevity):
Controller:
@RequestMapping(value="/forUserCalendar", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE)@ResponseBodypublic List<KendoSchedulerEvent> getCalendarEventsForUser(@RequestParam(value="userId", required = true) Long userId) { System.out.println("### forUserCalendar..."+userId); //Retrieves events from Database //Converts Domain Events to KendoSchedulerEvents return KendoSchedulerEvent.convertEvents(events);}HTML:
var dataSource_events = new kendo.data.SchedulerDataSource({ transport: { read: { url: "/itd-boot-thymeleaf-demo/events/forUserCalendar", dataType: "json", type: "GET" }, parameterMap: function(options, operation) { if (operation === "read") { var userId = $("#select-users").getKendoDropDownList().value(); var result = { userId: userId, } return result; } return options; } }});$("#scheduler-calendar").kendoScheduler({ autoBind: false, dataSource: dataSource_events});$("#select-users").kendoDropDownList({ dataSource: dataSource_users, dataValueField: "id", dataTextField: "fullName", change: function() { if (this.value() != "") { $("#scheduler-calendar").getKendoScheduler().dataSource.read(); } }});The Problem:
When my page loads, the read URL is being called from the DS, but there wont be a user selected at this stage as the page just loaded. Is there a way to prevent the DS from being read when its initialized? I thouhg that by including "autoBind" in the Scheduler would help, but its had no effect.
Please advise if you can.
Many Thanks,
Grant

Morning,
I've created a widget that uses the KendoScheuler inside a kendoWindow and sets its DataSource dynamically. Code below, shortened for brevity:
CODE:
function openWindow(optionOverrides) { var options = { /** * @type {Array | kendo.data.SchedulerDataSource} * @required * The dataSource where existing events are read from, can be a kendo.data.SchedulerDataSource or a JavaScript Array. * If an array is used a new kendo.data.SchedulerDataSource will be created with the 'data' attribute set as the array */ dataSource: null }; //Validate a dataSource exists if (!validateArgument(optionOverrides.dataSource, ["object"])) { console.error("SchedulerDataSource of incorrect type. Expected: object; found: " + typeof optionOverrides.dataSource); return false; } else { if ((optionOverrides.dataSource).constructor == Array) { //If the optionOverrides.dataSource is an array, use it to create a new kendo.data.SchedulerDataSource containing the array data var schedulerDS = new kendo.data.SchedulerDataSource({ data: optionOverrides.dataSource }); options.dataSource = schedulerDS; } else if ((optionOverrides.dataSource).constructor == kendo.data.SchedulerDataSource) { //Use optionOverrides.dataSource if it is already a kendo.data.SchedulerDataSource options.dataSource = optionOverrides.dataSource; } else { console.error("optionOverrides.dataSource object not of type Array or kendo.data.SchedulerDataSource"); return false; } } var dfd = $.Deferred(); var result = null; $("<div />") .attr("id", "window-schedulerWindow") .appendTo("body") .kendoWindow({ visible: false, modal: true, resizable: false, title: options.title, activate: function(e) { //Hide the headers of the scheduler var timePickerScheduler = $("#scheduler-scheduleTimePickerWindow-timePicker").data("kendoScheduler"); //Set data source after initialization. Prevents data being loaded before the scheduler is ready timePickerScheduler.setDataSource(options.dataSource); }, open: function(e) { var timePickerScheduler = $("#scheduler-scheduleTimePickerWindow-timePicker").kendoScheduler({ /* Attributes removed for Brevity */ edit: function(e) {
e.preventDefault(); //prevent default event editing
//Retrieve and sync the dataSource with the new event generated in the 'add' callback
var dataSource = this.dataSource;
dataSource.sync();
} }).getKendoScheduler(); }
}).data("kendoWindow") .content($("#template-schedulerTimePickerWindow").html()) .center() .open(); return dfd.promise();}The Problem:
So the issue Im having is that if the SDS is created fresh from an array of Event Objects, everything works fine, however, if I specify an already existing SDS, that uses remote data, and then start dragging and resizing events, I get the error: "Cannot read property 'data' of undefined", which points to statement 'dataSource.sync();' in the 'edit' event of my scheduler.
Is there some kind of sync trying to happen with the remote SDS? I monitored my network activity and didnt see anything.
Please advise, Thanks,
Grant
I want to use a template for my command button. like this:
command: [ { name: "editReport", template: "<button type='button' class='btn btn-link' title='Redigér rapport' data-ng-click='vm.onEdit()' data-ng-disabled='!vm.canEdit'><i class='fa fa-pencil' aria-hidden='true'></i></button>" } as any, { name: "deleteReport", template: "<button type='button' class='btn btn-link' title='Slet rapport' data-ng-click='vm.onDelete()' data-ng-disabled='!vm.canDelete'><i class='fa fa-minus' style='color:darkred' aria-hidden='true'></i></button>" } as any,],title: "Handlinger", width: 50We are in a Angular controller and I want to get the JQueryEventObject in the vm.onDelete() function.
If that not possible then maybe I could get the Id of the row in the binding vm.onDelete({{dataItem.Id}}).
Or is there another way to make a image button?
public onDelete = (e: JQueryEventObject) => { this.$confirm({ text: 'Ønsker du at slette rapporten?', title: 'Slet rapport', ok: 'Ja', cancel: 'Nej' }) .then(() => { var dataItem = this.mainGrid.dataItem(this.$(e.currentTarget).closest("tr")); var entityId = dataItem["Id"]; this.mainGrid.dataSource.remove(dataItem); this.mainGrid.dataSource.sync(); }); }
My app uses both Kendo MVVM and the Kendo Router. When I initialize a Kendo view I provide Kendo with my view and a view-model to bind. The outcome is a view-model and view that are constantly in sync.
I tried to take this a step further by caching the view-view-model results using the URL hash as the primary key/id. When I tried to reload a cached view-view-model the page displays correctly, but none of the binding work.
What am I missing?
Thanks!

I am loading a complex JSON object via AngularJS. The object contains several child collections that I want to display in Kendo UI grids. When I first load the page, the object doesn't exist at all. Periodically, the user can use a master list (not included here) to change the entire JSON object.
So far, I have the object loading correctly and displaying/working with AngularJS integration for the basic fields. The grid in question is configured to appear inside a Kendo TabStrip, as part of an AngularJS directive that displays my entire child form.
I currently define the grid (and tabStrip) in the Angular HTML template for the directive as:
<div class="detailTabStrip" kendo-tab-strip k-content-urls="[ null, null]"> <!-- tab list --> <ul> <li class="k-state-active">Facility Types</li> <li>Notes</li> </ul> <div style="padding: 1em"> <kendo-grid k-options="typeSnapshotGridOptions" k-scope-field="typeSnapshotGrid" style="height:99%;width:100%"> </kendo-grid> </div> <div style="padding: 1em"> TBD </div></div>My controller supplies the grid options:
$scope.typeSnapshotGridOptions = { dataSource: { data: [], pageSize: 5, }, sortable: true, groupable: false, resizable: true, useStaticHeaders: true, allowScroll: true, selectable: "row", pageable: { refresh: false, pageSizes: false, buttonCount: 5 }, autoSync: true, //dataBound: function () { // this.expandRow(this.tbody.find("tr.k-master-row").first()); //}, columns: [(...omitted for brevity...)]};And, when the JSON object is changed, it reinitializes the grid:
$scope.$on('facilitySelected', function (ev, args) { kendo.ui.progress($('#facilityDetailSection'), true); $http.get('/FacAdmin/GetFacilityDetail/' + args.facilityID) .then(function (response) { $scope.facility = response.data; $scope.typeSnapshotGrid.dataSource.data($scope.facility.TypeSnapshots); kendo.ui.progress($('#facilityDetailSection'), false); });});
As far as displaying data goes, this all works. The grid starts off invisible (because I have an ng-show vanishing the entire pane if there is no data), and it appears and shows the correct child rows each time I load a new complex JSON object.
However, the appearance is horrible. The grid appears about 100px tall (despite settings for 100% height and width, and use of useStaticHeaders and allowScroll) the very first time I load a JSON collection into it. On the second and subsequent loads, the grid appears the correct size and is almost right... the last row is missing the bottom border.
I have tried:
None of these had the slightest effect.
I am testing in Chrome and Chrome's debugger reports no JS errors. My Telerik version was installed from telerik.kendoui.professional.2016.2.714.commercial, which I assume also represents the version number.
Attached: Screenshot of grid appearance on first load of the child collection (_1) and on subsequent loads (_2).
Please suggest additional possible fixes.
Hi,
I noticed, that when using a validation for kendo grid fields, only some fields get the k-invalid class. This can be easily seen on the demo page: http://demos.telerik.com/kendo-ui/grid/editing-custom-validation .
All the empty fields are correctly validated, but only ProductName fields has the k-invalid class. The Unit Price and Units In Stock don't (they still kave the k-valid class, although there is tooltip saying that field is required). So my problem is that I want to style invalid fields with red background etc, and it simply doesn't work for numeric fields.
Is that a known issue? Any workarounds for now?
Thanks,
Pawel

It seems that even though the internally created object should be getting a new datasource it is being shared across objects. It is kind of a hard behavior to explain so here is the code. I assume that I am doing something wrong but I don't really know what is expected since I can't seem to find a good example of complex MVVM models with differing datasources... I can use an array and that works fine but if I change it to observable array or a data source I get an unexpected result. So like I said I am probably doing it wrong?
Here is an example of the behavior that I am seeing.
<div id="example"> <div > <button data-bind="events{click:addItem}">add</button> <ul data-template="item-template" data-bind="source: items" data-value-update="onChange"></ul> </div> </div> <script id="item-template" type="text/x-kendo-template"> <li> <button data-bind="events{click:addSubItem}">add</button> <label data-bind="text: name"></label> <ul data-template="sub-item-template" data-bind="source: subItems" data-value-update="onChange"></ul> </li> </script> <script id="sub-item-template" type="text/x-kendo-template"> <li><label data-bind="text: name"></label></li> </script> <script> $(document).ready(function() { var mySubClass = kendo.Class.extend({ init:function(){}, name: '' }); var myClass = kendo.Class.extend({ init: function(){}, name: 'ParentItem', subItems: new kendo.data.DataSource({data:[]}), addSubItem: function(){ var item = new mySubClass(); item.name = 'item: ' + (this.subItems.data().length + 1); this.subItems.add(item); } }); var viewModel = kendo.observable({ items: new kendo.data.DataSource({data: [new myClass()]}), addItem: function(){ this.items.add(new myClass());} }); kendo.bind($("#example"), viewModel); }); </script> 
