script>
var viewModel = null;
$(document).ready(function() {
var treeview;
$("#vertical").kendoSplitter({
orientation: "vertical",
panes: [
{ collapsible: true, size: "50%" },
{ collapsible: true, size: "50%" }
]
});
$("#horizontal").kendoSplitter({
panes: [
{ collapsible: true, size: "35%" },
{ collapsible: true, size: "65%" }
]
});
treeview = $("#treeview").kendoTreeView({
template: kendo.template($("#treeview-template").html()),
dragAndDrop: false,
dataSource: [@(Html.Raw(Model.Json))],
select: onSelect
}).data("kendoTreeView");
var productdata = @(Html.Raw(Model.JsonProducts));
viewModel = kendo.observable({
gridSource: productdata
});
$("#grid").kendoGrid({
dataSource: {
data: viewModel.gridSource,
pageSize: 10
},
autoBind:true,
selectable: "multiple, row",
groupable: false,
scrollable: true,
sortable: true,
pageable: false,
drop: droptargetOnDrop,
columns: [
{
field: "id",
width: 50,
title: "Id"
},
{
field: "categoryid",
width: 250,
title: "Category Id"
}, {
field: "productname",
width: 250,
title: "Product Name"
}
]
});
$("#grid").kendoDraggable({
filter: "tr",
hint: function() {
var g = $("#grid").data("kendoGrid");
return g.select().clone();
}
});
$("#treeview").kendoDropTarget({
dragAndDrop: true,
drop: droptargetOnDrop
});
});
function onSelect(e) {
var url = "/home/UpdateListingByCategory";
var selectedCatId = $(e.node.children[0]).find("input").val();
$.ajax({
type: "POST",
url: url,
data: { categoryId: selectedCatId },
success: function(data) {
viewModel.gridSource = JSON.parse(data);
alert(viewModel.gridSource);
},
error: function() {
alert("error");
}
});
}
function droptargetOnDrop(e) {
var ss = e.srcElement.parentElement.children[1];
var url = "/home/update";
var list = new Array();
for (var i=0; i < e.draggable.hint.length; i++) {
var id = e.draggable.hint[i].firstChild.innerHTML;
list.push(id);
}
$.ajax({
type: "POST",
url: url,
data: { categoryId: $(ss).val(), productIds: list.join() },
success: function(data) {
viewModel.gridSource = JSON.parse(data);
},
error: function() {
alert("error");
}
});
kendo.bind($("#grid"), viewModel);
}
</script>
|
Requirements |
|
|
Kendo UI for ASP.NET MVC Q2 2012 SP1 |
|
|
jQuery v1.7.1 |
|
|
IE8, FF18 |
|
|
Components/Widgets Grid |
|
So, on the KendoEditor there is a Tooltip field. as the title states, this field only populates the Alt attribute. This only works as a tooltip in IE <= 7. It should be populating the Title attribute (or, perhaps both for compatibility) or be renamed to match what it actually does.
$(document).ready(function () { var dateFormat = "{0:M/d/yy}"; var datetimeFormat = "{0:M/d/yy h:mm tt}"; var d = new Date(2012, 11, 8, 11, 20); var d2 = new Date(2012, 11, 8); $('#StartWithDate').kendoDateTimePicker({ value: d, format: (d.getHours() === 0) ? dateFormat : datetimeFormat, change: function(e) { /* what goes here */ } }); $('#StartWithDateTime').kendoDateTimePicker({ value: d2, format: (d2.getHours() === 0) ? dateFormat : datetimeFormat, change: function(e) { /* what goes here */ } }); });var viewModel = kendo.observable({ OrderNumber: { Value: '', IsValid: function(){ return (this.get('Value').length >= 8); }, Message: function(){ if(this.get('IsValid')){ return ''; } else{ return 'Text length must be at least 8 characters.'; } } }});