We have a very large datastore connected to a kendo grid, so it's important that the DataSourceRequest object is translated to the sql for server paging, filtering, etc.
One issue is that the datastore stores employee ids and we want to display their names and have a checkbox filter datasource that shows all unique names (not just the names from the paged views).
I have this all working but I'm currently hijacking the DataSourceRequest and manually parsing through and converting the FIlterDescriptor objects from the display names to the ids in the database.
I've done plenty of wrangling trying to get this all to work with client templates to no avail.
Here's a code snippet that represents what I'm doing. Is there a better approach?
<
p
>public JsonResult GetAssets([DataSourceRequest] DataSourceRequest request)
{
var assetQuery = _assetRepository.GetAllKendoReadOnly();
request = ToAssetDataSourceRequest(request); //converts filters from name to id
var assets = assetQuery.ToDataSourceResult(request, ToAssetViewModel); //ToAssetViewModel populates names from ids
return Json(assets, JsonRequestBehavior.AllowGet);
}
private DataSourceRequest ToAssetDataSourceRequest(DataSourceRequest request)
{
if (request.Filters != null && request.Filters.Any())
{
foreach (var iFilter in request.Filters)
{
ConvertFilter(iFilter);
}
}
return request;
}
private void ConvertFilter(IFilterDescriptor descriptor)
{
switch (descriptor)
{
case FilterDescriptor filterDescriptor:
ToConvertedDescriptor(filterDescriptor);
break;
case CompositeFilterDescriptor compositeFilterDescriptor:
foreach (var compositeFilter in compositeFilterDescriptor.FilterDescriptors)
{
ConvertFilter(compositeFilter);
}
break;
}
}
private void ToConvertedDescriptor(FilterDescriptor filter)
{
switch (filter.Member)
{
case "OnwerName":
filter.Member = "OwnerEmployeeNumber";
filter.Value = GetEmployeeNumber(filter.Value.ToString());
break;
case "CustodianName":
filter.Member = "CustodianEmployeeNumber";
filter.Value = GetEmployeeNumber(filter.Value.ToString());
break;
case "UserName":
filter.Member = "UserEmployeeNumber";
filter.Value = GetEmployeeNumber(filter.Value.ToString());
break;
}
}</
p
><
p
></
p
>
function addCellClickEventListener()
{
var grid = $('#grid').data('kendoGrid');
$(grid.tbody).on('click',"> tr:not(.k-grouping-row, .k-detail-row, .k-group-footer) td.dow", function(){
// get some additional data from the server based on values from the row to
// which the clicked-on cell belongs -- works OK -- reference to grid is valid
.
.
.
var windowObject = $("#messagewindow").data("kendoWindow").open();
// windowObject is undefined
});
}
StockChart do not display last item from dataSource when changing selection of navigation in javascript code. Currently I'm using 2016.1.412 but this is the same problem with latest version. After setting navi.selection.set function chart navigation is expanding but not displaying last element from the array.
My code is working fine with kendo 2014.2.1008 but not with 2016.1.412
var lastItem = {"Date":"2018-03-20T00:00:00.000Z","Open":99.95,"High":109.9,"Low":92.7,"Close":92.7,"value":92.7,"volume":828222,"oi":0};
var chartModel = [
{"Date":"2018-03-18T00:00:00.000Z","Open":90.15,"High":94,"Low":90.15,"Close":90.95,"value":90.95,"volume":200082,"oi":0},
{"Date":"2018-03-19T00:00:00.000Z","Open":90.2,"High":100,"Low":90.2,"Close":100,"value":100,"volume":281,"oi":0},
{"Date":"2018-03-20T00:00:00.000Z","Open":99.95,"High":109.9,"Low":92.7,"Close":92.7,"value":92.7,"volume":828222,"oi":0}
];
$("#stock-chart").kendoStockChart({
dataSource: {
data: chartModel
},
title: {
text: "The Boeing Company \n (NYSE:BA)"
},
dateField: "Date",
series: [{
type: "candlestick",
openField: "Open",
highField: "High",
lowField: "Low",
closeField: "Close"
}],
navigator: {
series: {
type: "area",
field: "Close"
}
}
});
$("#set").click(function setSelection() {
var chart = $("#stock-chart").getKendoStockChart();
var navi = chart._navigator;
chart.dataSource.data(chartModel);
if (navi) {
navi.selection.set(
new Date(chartModel[0].Date),
new Date(chartModel[chartModel.length - 1].Date)
);
if (navi._selectEnd) {
navi._selectEnd();
}
chart.dataSource.data(chartModel);
}
});
setInterval(function(){
lastItem.Date = new Date(lastItem.Date).setDate(new Date(lastItem.Date).getDate() + 1);
chartModel.push(Object.assign({},lastItem));
}, 3000);
Hello, I'm struggling with a small issue:
I have a weekly grouped scheduler and I'm trying to hide the 12:00 to 14:00 time slot.
I've tryed to hide bu css:
.k-scheduler-content tr:nth-child(5),
.k-scheduler-content tr:nth-child(6),
.k-scheduler-times .k-scheduler-table tr:nth-child(5),
.k-scheduler-times .k-scheduler-table tr:nth-child(6) {
display:none;
}
I've tryed to delay the hiding in the databound event but something is not working correctly, some events are shifted in the wrong time slot and the drag&drop is not working correctly.
Is there a easy way to hide a specific time row?
Hi,
I wonder if there is any way to include in a dropzone container a functionality of uploading a file
by clicking on it? In other words keep two functionalities in one place.
I'll leave here the dojo sandbox for reference https://dojo.telerik.com/iFEriwoK
Best regards,
Emanuele
I have a scheduler with the following code for moveEnd
moveEnd: function (e) {
//For Work Managers this code will give the option to clone or move when an event is moved.
if ($WorkManager == 'true') {
e.preventDefault();
eventHolder = e;
var dialog = $("#schedulerWindow").data("kendoWindow");
dialog.center();
dialog.open();
}
},
The dialog has just two buttons CLONE which has an onclick function of onClone() and MOVE which has an onclick function of onMove(). These functions are listed below.
function onClone() {
var dialog = $("#schedulerWindow").data("kendoWindow");
var scheduler = $("#scheduler").data("kendoScheduler");
dialog.close();
var copy = eventHolder.event.toJSON();
copy.start = eventHolder.start;
copy.end = eventHolder.end;
copy.RID = -1;
delete copy.uid;
scheduler.dataSource.add(copy);
scheduler.dataSource.sync();
eventHolder = null;
}
function onMove() {
var dialog = $("#schedulerWindow").data("kendoWindow");
var scheduler = $("#scheduler").data("kendoScheduler");
dialog.close();
eventHolder.event.set("start", eventHolder.start);
eventHolder.event.set("end", eventHolder.end);
scheduler.dataSource.sync();
eventHolder = null;
}
This was fine when you could only select one event at a time. The latest version of the code will allow the use of Ctrl Click to select several events
If I select several events and try and clone or move only the last clicked event is cloned/moved. What changes to the Clone and Move functions do I need to make for this to work with one or more selected events.
Thanks
I am writing an asp.net mvc app that uses the scheduler to my allow users as well as resources to manage their own calendars (including recurring events). I also allow users to create events that require both attendees as well as resources to attend.
I need to be able to validate that the newly proposed event does not have any conflicts with the resources and attendees. I would be good to do this in the browser, but ultimately it needs to also be done on the server because multiple people could be doing scheduling at the same time.
The big question is how to handle possible recurrence
Thanks!
-Logan
Hello i am using .kendoSortable and i want to restrict the user from dropping rows at the column headers line. is this possible?
I have added filter in dropdownlist. After user selects item from filter, when the program tried to select another item in dropdownlist, it will use the filtered list, not the original list. How can I use the original full list to change selection? Thanks.
var dropdownlist = $("#fac").data("kendoDropDownList");
dropdownlist.select(function (dataItem) { <============================
return dataItem.FacCode === s + e.faccode;
});