I have two Kendo UI TreeViews on one page. For example:
var data1 = new kendo.data.HierarchicalDataSource({
data: [
{ text: "foo", items: [
{ text: "believe" },
{ text: "Sofas" },
{ text: "Occasional Furniture" }
] },
{ text: "Decor", items: [
{ text: "Bed Linen" },
{ text: "Curtains & Blinds" },
{ text: "Carpets" }
] }
]
});
var data2 = new kendo.data.HierarchicalDataSource({
data: [
]
});
$("#treeview-1").kendoTreeView({
dataSource: data1
});
$("#treeview-2").kendoTreeView({
dataSource: data2
});
$('#copy-button').click(function(e){
// what goes here?
});
How can I copy the data from one tree to the other? It's OK if the destination tree's existing data is overwritten.
Thanks!
You need to retrieve the data of the first tree and assign it to the DataSource of the second. Something like:
// Access both trees
var tree1 = $("#treeview-1").data("kendoTreeView");
var tree2 = $("#treeview-2").data("kendoTreeView");
// Get the data from the first tree
var data = tree1.dataSource.data();
// Assign it to the second tree
tree2.dataSource.data(data);
A snippet
$(document).ready(function() {
var data1 = new kendo.data.HierarchicalDataSource({
data: [
{ text: "foo", items: [
{ text: "believe" },
{ text: "Sofas" },
{ text: "Occasional Furniture" }
] },
{ text: "Decor", items: [
{ text: "Bed Linen" },
{ text: "Curtains & Blinds" },
{ text: "Carpets" }
] }
]
});
var data2 = new kendo.data.HierarchicalDataSource({
data: [
]
});
$("#treeview-1").kendoTreeView({
dataSource: data1
});
$("#treeview-2").kendoTreeView({
dataSource: data2
});
$('#copy-button').click(function(e){
var tree1 = $("#treeview-1").data("kendoTreeView");
var tree2 = $("#treeview-2").data("kendoTreeView");
var data = tree1.dataSource.data();
tree2.dataSource.data(data)
});
});
#treeview-1 {
border: 1px solid red;
padding: 5px;
min-height: 40px;
}
#treeview-2 {
border: 1px solid green;
padding: 5px;
min-height: 40px;
}
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1411/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1411/styles/kendo.default.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdn.kendostatic.com/2014.3.1411/js/kendo.all.min.js"></script>
<button id="copy-button" class="k-button">Copy</button>
<div id="treeview-1"></div>
<div id="treeview-2"></div>
Related
I have the following project. There you can click on the individual checkboxes and the ID is written (see Console).
Then I have tested the ServerPaging. This works in another project (there are no checkboxes). If I change the above project to ServerPaging, I can click on the checkbox, but it reloads the DataSource. What can I do here?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Grid with checkboxes</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.3.911/styles/kendo.bootstrap-v4.min.css" />
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.3.911/js/kendo.all.min.js"></script>
<script src="https://demos.telerik.com/kendo-ui/content/shared/js/console.js"></script>
</head>
<body>
<style>
html {
font-size: 14px;
font-family: Arial, Helvetica, sans-serif;
}
label {
float: left;
line-height: 1;
}
[role='gridcell'] {
box-shadow: none !important;
}
.checkColumnCenter {
text-align: center;
width: 20px;
}
.fieldlist {
margin: 0 0 -1em;
padding: 0;
}
.fieldlist li {
list-style: none;
padding-bottom: 1em;
}
</style>
<div id="example">
<div id="grid"></div>
</div>
<script>
$(document).ready(function() {
var MainArray = [];
var subArray = [];
var selectedItems = [];
var pageNum;
var initialLength = 0;
var confirmedArray = [];
var crudServiceBaseUrl = "https://demos.telerik.com/kendo-ui/service",
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Products",
dataType: "jsonp"
},
update: {
url: "https://demos.telerik.com/kendo-ui/service/products/update",
dataType: "jsonp"
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
return kendo.data.transports["odata"].parameterMap(options, operation);
}
},
pageSize: 10,
type: "odata",
batch: true,
serverPaging: false,
serverSorting: false,
/*serverPaging: true,
serverFiltering: true,
serverSorting: true,
batch: true,*/
schema: {
model: {
id: "ProductID",
fields: {
ProductID: { editable: false, nullable: true },
ProductName: { validation: { required: true } },
UnitPrice: { type: "number", validation: { required: true, min: 1 } },
Discontinued: { type: "boolean" },
UnitsInStock: { type: "number", validation: { min: 0, required: true } }
}
},
data: function (response) {
return response.d ? response.d.results: response;
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
height: 350,
navigatable: true,
pageable: true,
sortable: true,
persistSelection: true,
filterable: {
extra: false,
mode: 'row',
operators: {
string: {
contains: "Contains",
startswith: "Starts with",
eq: "Equal",
neq: "Not equal"
}
},
messages: {
isTrue: "checked",
isFalse: "selectable"
}
},
resizable: true,
columns: [{
field: "Discontinued",
width: 150,
template: "<input type='checkbox' onclick='checkOne()' data-bind='checked:Discontinued' />",
headerTemplate: "<input id='checkAll' type='checkbox' onclick='checkAll(this)'/><span id='checkAllPtext'></span>",
attributes: {
"class": "checkColumnCenter",
style: "color:\\#0c0"
}
},
{
field: "ProductName",
title: "Product",
width: 150
},
{
field: "UnitPrice",
title: "Unit",
width: 120
},
{
field: "UnitsInStock",
title: "Costplace",
width: 120
},
],
dataBound: function(e) {
if(this.dataSource.filter()){
$('#checkAll').show();
$('#checkAllPtext').show().html("All");
} else {
$('#checkAll').hide();
$('#checkAllPtext').hide();
}
selectedItems = [];
var selectedItemsPage = [];
e.sender.items().each(function() {
var dataItem = e.sender.dataItem(this);
kendo.bind(this, dataItem);
if (dataItem.Discontinued) {
var grid = $("#grid").data("kendoGrid");
var dataItem = grid.dataItem(this);
selectedItemsPage.push(dataItem);
$(this).addClass("k-state-selected");
}
});
if (pageNum == e.sender.dataSource._page) {
// kendoConsole.log('initialLength', initialLength)
if (initialLength !== 0) {
// MainArray.splice(-initialLength);
// kendoConsole.log('subArray', MainArray.indexOf(subArray[0]))
subArray.forEach(function(item, i) {
MainArray.splice(MainArray.indexOf(item), 1);
});
}
if (selectedItemsPage.length > 0) {
selectedItems = selectedItemsPage;
}
subArray = selectedItemsPage;
initialLength = selectedItems.length;
} else {
selectedItemsPage.forEach(function(item) {
if (MainArray.indexOf(item) > -1) {
MainArray.splice(MainArray.indexOf(item), 1);
}
});
pageNum = e.sender.dataSource._page;
if (selectedItemsPage.length > 0) {
selectedItems = selectedItemsPage;
}
subArray = selectedItemsPage;
initialLength = selectedItems.length;
}
MainArray = MainArray.concat(selectedItems);
// kendoConsole.log(MainArray);
$("#checkAll")[0].checked = e.sender.items().find(":checked").length == e.sender.dataSource.view().length;
}
});
setTimeout(function() {
getMarked();
}, 500);
getMarked = function() {
dataSource.fetch(function() {
confirmedArray = dataSource._data.filter(function(item) {
return item.Discontinued;
})
var confirmedIDs = confirmedArray.map(function(item) {
return item.ProductID;
});
kendoConsole.log(JSON.stringify("Selected ID's: " + confirmedIDs));
})
}
// setTimeout(function () {
// getMarked();
// }, 200);
});
var getMarked;
function checkOne() {
setTimeout(function() {
getMarked();
}, 100);
}
function checkAll(input) {
var grid = $("#grid").data("kendoGrid");
var items = grid.items();
items.each(function() {
var dataItem = grid.dataItem(this);
if (dataItem.Discontinued != input.checked) {
dataItem.Discontinued = input.checked;
dataItem.dirty = true;
}
})
grid.dataSource.sync();
setTimeout(function() {
getMarked();
}, 100);
}
</script>
<div class="box wide">
<h4>Console log</h4>
<div class="console"></div>
</div>
<style>
.console div {
height: 6em;
}
</style>
</body>
</html>
I helped it with a simple check array.length > 0
getMarked = function() {
if (array.length > 0) {
// foo nothing
}
dataSource.fetch(function() {
confirmedArray = dataSource._data.filter(function(item) {
return item.Discontinued;
})
var confirmedIDs = confirmedArray.map(function(item) {
return item.ProductID;
});
})
}
The problem was that the grid was reloaded every time after an action. Since the changes in the grid have not been saved yet, he has discarded the changes each time. Is a good workaround for me.
I created this Dojo Link that shows me resource by group. problem with this view is it shows long block only if it's a allDay event. for this view how can i apply a template that show a block with time range for each event?
currently it is showing small block and its hard to tell what it is or how long it is booked for.
I want all the event block to take full length despite the duration length.
similar to one highlighted below
Look at the code snippet below. I did a couple of things:
I removed the title data from the template of the event since you said you didn't want to see it.
I placed a space in the template after the <p> element so that the x action of the event will have a place to appear in. There are other ways to do this, I used a simple one.
I've made changes to the styles at the bottom of the code, specifically the following:
.movie-template {
overflow: auto !important;
width: fit-content !important;
}
.k-event {
width: fit-content !important;
}
.space {
width: 20px;
height: 15px;
display: inline-block;
}
.movie-template p {
margin: 5px 0 0;
display: inline-block;
}
EDIT
~~~~
Making the appointments fill the cells they belong to is either impossible or extremely complicated. I'll explain why:
The way the events are programmed, they exist on the same level on the DOM as the table of the scheduler and float above it. The scheduler calculates the position and size of the events based on their start and end times.
In order for you to place them as if they are full-day events you need to do one of two things:
Override the scheduler's automatic placement, with your own code that will calculate the position and size and set them accordingly. Note that this code will need to run every time the window is resized, re-focused, rotated and so on.
Define the events as "whole-day appointments" and store their real start and end times in other fields that you will use in your code. This might break other functionality you might already have in place.
<!DOCTYPE html>
<html>
<head>
<base href="https://demos.telerik.com/kendo-ui/scheduler/resources-grouping-vertical">
<style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
<title></title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.common-material.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.material.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.1.221/styles/kendo.material.mobile.min.css" />
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/kendo.all.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2018.1.221/js/kendo.timezones.min.js"></script>
</head>
<body>
<div id="example" class="k-content">
<div id="scheduler"></div>
</div>
<script id="event-template" type="text/x-kendo-template">
<div class="movie-template" style="width:100px">
<p>#: kendo.toString(start, "hh:mm") # - #: kendo.toString(end, "hh:mm") #</p>
<span class="space"></span>
</div>
</script>
<script>
var MyCustomTimelistView = kendo.ui.TimelineMonthView.extend({
options: {
name: "MyCustomTimelistView",
title: "Timeline Week",
selectedDateFormat: "{0:D} - {1:D}",
selectedShortDateFormat: "{0:d} - {1:d}",
majorTick: 1440,
numberOfDays: 7
},
name: "MyCustomTimelistView",
calculateDateRange: function() {
//create the required number of days
var start = this.options.date,
// start = kendo.date.dayOfWeek(selectedDate, this.calendarInfo().firstDay, -1),
idx, length,
dates = [];
for (idx = 0, length = this.options.numberOfDays; idx < length; idx++) {
dates.push(start);
start = kendo.date.nextDay(start);
}
this._render(dates);
},
previousDate: function() {
var date = new Date(this.startDate());
date.setDate(date.getDate() - this.options.numberOfDays);
return date
}
});
$(function() {
$("#scheduler").kendoScheduler({
date: new Date("2013/6/13"),
startTime: new Date("2013/6/13 07:00 AM"),
height: 600,
eventTemplate: $("#event-template").html(),
views: [
"day",
{ type: "MyCustomTimelistView", selected: true,
},
"month",
"agenda",
"timeline"
],
timezone: "Etc/UTC",
dataBinding: function(e) {
var view = this.view();
$( ".k-scheduler-times > table > tbody > tr:eq(1)" ).hide();
$( ".k-scheduler-header-wrap > table > tbody > tr:eq(1)" ).hide();
},
dataSource: {
batch: true,
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/meetings",
dataType: "jsonp"
},
update: {
url: "https://demos.telerik.com/kendo-ui/service/meetings/update",
dataType: "jsonp"
},
create: {
url: "https://demos.telerik.com/kendo-ui/service/meetings/create",
dataType: "jsonp"
},
destroy: {
url: "https://demos.telerik.com/kendo-ui/service/meetings/destroy",
dataType: "jsonp"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
schema: {
model: {
id: "meetingID",
fields: {
meetingID: { from: "MeetingID", type: "number" },
title: { from: "Title", defaultValue: "No title", validation: { required: true } },
start: { type: "date", from: "Start" },
end: { type: "date", from: "End" },
startTimezone: { from: "StartTimezone" },
endTimezone: { from: "EndTimezone" },
description: { from: "Description" },
recurrenceId: { from: "RecurrenceID" },
recurrenceRule: { from: "RecurrenceRule" },
recurrenceException: { from: "RecurrenceException" },
roomId: { from: "RoomID", nullable: true },
attendees: { from: "Attendees", nullable: true },
isAllDay: { type: "boolean", from: "IsAllDay" }
}
}
}
},
group: {
resources: ["Rooms"],
orientation: "vertical"
},
resources: [
{
field: "roomId",
name: "Rooms",
dataSource: [
{ text: "Meeting Room 101", value: 1, color: "#6eb3fa" },
{ text: "Meeting Room 201", value: 2, color: "#f58a8a" }
],
title: "Room"
},
{
field: "attendees",
name: "Attendees",
dataSource: [
{ text: "Alex", value: 1, color: "#f8a398" },
{ text: "Bob", value: 2, color: "#51a0ed" },
{ text: "Charlie", value: 3, color: "#56ca85" }
],
multiple: true,
title: "Attendees"
}
]
});
});
</script>
<style>
.movie-template {
overflow: auto !important;
width: fit-content !important;
}
.k-event {
width: fit-content !important;
}
.space {
width: 20px;
height: 15px;
display: inline-block;
}
.movie-template img {
float: left;
margin: 0 8px;
}
.movie-template p {
margin: 5px 0 0;
display: inline-block;
}
.movie-template h3 {
padding: 0 0 5px;
font-size: 12px;
}
.movie-template a {
color: #ffffff;
font-weight: bold;
text-decoration: none;
}
.k-state-hover .movie-template a,
.movie-template a:hover {
color: #000000;
}
</style>
</body>
</html>
you can create custom views like this and use it in your code
var CustomMonthView = kendo.ui.TimelineMonthView.extend({
options: {
name: "CustomMonth",
title: "Month"
},
name: "CustomMonth",
_positionEvent: function(eventObject) {
var eventHeight = this.options.eventHeight + 2;
var rect = eventObject.slotRange.innerRect(eventObject.start, eventObject.end, true);
var left = this._adjustLeftPosition(rect.left);
var width = rect.right - rect.left - 2;
if (width < 0) {
width = 0;
}
if (width < this.options.eventMinWidth) {
var slotsCollection = eventObject.slotRange.collection;
var lastSlot = slotsCollection._slots[slotsCollection._slots.length - 1];
var offsetRight = lastSlot.offsetLeft + lastSlot.offsetWidth;
width = this.options.eventMinWidth;
if (offsetRight < left + width) {
width = offsetRight - rect.left - 2;
}
}
eventObject.element.css({
top: eventObject.slotRange.start.offsetTop + eventObject.rowIndex * (eventHeight + 2) + 'px',
left: left,
width: width
});
},
_arrangeRows: function (eventObject, slotRange, eventGroup) {
var startIndex = slotRange.start.index;
var endIndex = slotRange.end.index;
var rect = eventObject.slotRange.innerRect(eventObject.start, eventObject.end, true);
var rectRight = rect.right + this.options.eventMinWidth;
var events = kendo.ui.SchedulerView.collidingEvents(eventObject.slotRange.events(), startIndex, endIndex);
slotRange.addEvent({
slotIndex: startIndex,
start: startIndex,
end: endIndex,
rectLeft: rect.left,
rectRight: rectRight,
element: eventObject.element,
uid: eventObject.uid
});
events.push({
start: startIndex,
end: endIndex,
uid: eventObject.uid
});
var rows = kendo.ui.SchedulerView.createRows(events);
if (eventGroup.maxRowCount < rows.length) {
eventGroup.maxRowCount = rows.length;
}
for (var idx = 0, length = rows.length; idx < length; idx++) {
var rowEvents = rows[idx].events;
for (var j = 0, eventLength = rowEvents.length; j < eventLength; j++) {
eventGroup.events[rowEvents[j].uid].rowIndex = idx;
}
}
}
});
hope this helps
We can copy paste the value of a cell into other cells when we are batch editing . Now want to know weather we can copy paste an entire row with in the same grid.
Found this http://www.telerik.com/forums/copy-and-paste-rows-in-kendo-ui-asp-net-mvc-grid but its between grids and requires selection and keyboard navigation to be disabled, but i need selection and keyboard navigation and selection functionality.
The easiest way is working at model level. I.e. identify the data corresponding to the row that you select and then append that data to the datasource.
Since you mention in a comment that the rows being duplicated are marked with a checkbox, what you can do is:
// Items to insert
var items = [];
// For the rows with checked item
$(":checked", grid.tbody).each(function(idx, elem) {
// Get the row
var row = $(elem).closest("tr");
// Get the item for that row
var item = grid.dataItem(row);
items.push(item);
});
// Insert it in the DataSource
for (var i = 0; i < items.length; i++) {
grid.dataSource.add(items[i]);
}
$(document).ready(function() {
var grid = $("#grid").kendoGrid({
dataSource: {
data: products,
schema: {
model: {
fields: {
CheckBox: { type: "boolean" },
ProductName: { type: "string" },
UnitPrice: { type: "number" },
UnitsInStock: { type: "number" },
Discontinued: { type: "boolean" }
}
}
},
pageSize: 4
},
scrollable: true,
pageable: true,
columns: [
{ field: "CheckBox", title:" ", template: "<input type='checkbox'/>", width: 30 },
"ProductName",
{ field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "130px" },
{ field: "UnitsInStock", title: "Units In Stock", width: "130px" },
{ field: "Discontinued", width: "130px" }
]
}).data("kendoGrid");
$("#duplicate").on("click", function() {
var items = [];
$(":checked", grid.tbody).each(function(idx, elem) {
var row = $(elem).closest("tr");
var item = grid.dataItem(row);
items.push(item);
});
for (var i = 0; i < items.length; i++) {
grid.dataSource.add(items[i]);
}
});
});
html { font-size: 12px; font-family: Arial, Helvetica, sans-serif; }
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1316/styles/kendo.common.min.css" />
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1316/styles/kendo.default.min.css" />
<script src="http://cdn.kendostatic.com/2014.3.1316/js/jquery.min.js"></script>
<script src="http://cdn.kendostatic.com/2014.3.1316/js/kendo.all.min.js"></script>
<script src="http://demos.telerik.com/kendo-ui/content/shared/js/products.js"></script>
<button id="duplicate" class="k-button">Duplicate</button>
<div id="grid"></div>
Is there any method like that dataSource.getFieldType(field) in datasource:
var dataSource = new kendo.data.DataSource({
// somethings here,
schema : {
model : {
post_id : {type: "number" },
post_title : {type:"string"},
post_date : {type:"date"}
}
}
});
var fieldType = dataSource.getFieldType("post_title"); // it should return string
You should define a getFieldType function as:
function getFieldType(dataSource, field) {
return dataSource.options.schema.model.fields[field].type;
}
and using it would be:
var fieldType = getFieldType(dataSource, "post_title");
Alternatively, you can extend KendoUI DataSource for defining a new method called getFieldType by doing:
kendo.data.DataSource.prototype.getFieldType = function(field) {
return this.options.schema.model.fields[field].type;
}
and using it would be:
var fieldType = dataSource.getFieldType("post_title");
Check here the version using DataSource extension:
$(document).ready(function() {
kendo.data.DataSource.prototype.getFieldType = function(field) {
return this.options.schema.model.fields[field].type;
}
$("#show").on("click", function() {
var ds = $("#grid").data("kendoGrid").dataSource;
alert("Freight: " + ds.getFieldType("Freight"));
});
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"
},
schema: {
model: {
fields: {
OrderID: { type: "number" },
Freight: { type: "number" },
ShipName: { type: "string" },
OrderDate: { type: "date" },
ShipCity: { type: "string" }
}
}
},
pageSize: 20,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 550,
pageable: true,
columns: [
{
field:"OrderID",
filterable: false
},
"Freight",
{
field: "OrderDate",
title: "Order Date",
format: "{0:MM/dd/yyyy}"
},
{
field: "ShipName",
title: "Ship Name"
},
{
field: "ShipCity",
title: "Ship City"
}
]
});
});
html {
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1316/styles/kendo.common.min.css" />
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1316/styles/kendo.default.min.css" />
<script src="http://cdn.kendostatic.com/2014.3.1316/js/jquery.min.js"></script>
<script src="http://cdn.kendostatic.com/2014.3.1316/js/kendo.all.min.js"></script>
<button id="show" class="k-button">Show Freight type</button>
<div id="grid"></div>
When using a editor grid and my button put a new row at the bottom, validation messages are being hidden by the grid.
I have set up an example here: http://jsfiddle.net/api2304/K54v3/1/
Click on a button Add
Leave the cell Name empty and press tab.
The message will show below the row.
Html:
<div id="grid"></div>
Javascript:
var _dsGrid;
var _grid;
var _this = this;
_this._dsGrid = new kendo.data.DataSource({
autoSync: true,
data: [{ Cod: 0, Name: 'Value0' },
{ Cod: 1, Name: 'Value1' }],
schema: {
model: {
fields: {
Cod: { editable: false },
Name: {
validation: {
required: true,
required: { message: "Custom message" }
}
}
}
}
}
});
_this._grid = $("#grid").kendoGrid({
columns: [
{ field: "Cod" },
{ field: "Name" }
],
selectable: true,
dataSource: _this._dsGrid,
editable: true,
toolbar: [
{ template: kendo.template("<a id='btnAdicionar' class='k-button k-button-icontext'><span class='k-icon k-add'></span>Adicionar</a>") }
],
edit: function(e) {
e.container.find("input[name='Nome']").attr('maxlength', '20');
e.container.find("input").bind("blur", function() {
$("#grid").scrollTop($("#grid")[0].scrollHeight + 200);
});
}
}).
data("kendoGrid");
$("#btnAdicionar").click(function () {
var total = _this._dsGrid.data().length;
var insert = _this._dsGrid.insert(total, {});
_this._dsGrid.page(_this._dsGrid.totalPages());
var ultimoId = _this._dsGrid.data()[total - 1].Nivel;
_this._grid.editRow(_this._grid.tbody.children().last());
});
I found the solution here: http://www.telerik.com/forums/hidden-validators-when-virtual-scrolling-createat-bottom
Put this css on the page:
#grid .k-tooltip-validation {
margin-top: 0 !important;
display: block;
position: static;
padding: 0;
}
#grid .k-callout {
display: none;
}