I have a function called setFilter, which sets up the current filter for the kendo scheduler and looks like:
function setFilter(){
//console.log(ownerIdArr);
//console.log(typeIdArr);
//console.log(locIdArr);
//console.log(descripIdArr);
//console.log(dateIdArr);
scheduler.dataSource.filter({
operator: function(task) {
//console.log(task);
//Check for all 5 filters
if(ownerIdArr.length > 0 && descripIdArr.length > 0 && locIdArr.length > 0 && picklistIdArr.length > 0 && dateIdArr > 0)
return ($.inArray(task.location, locIdArr) >= 0 && $.inArray(task.taskId, descripIdArr) >= 0 && getInvitedUsers(task, ownerIdArr) && filterPicklists(task) && $.inArray(task.taskId, dateIdArr) >= 0);
//Check 4 filters
else if(ownerIdArr.length > 0 && descripIdArr.length > 0 && locIdArr.length > 0 && picklistIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && $.inArray(task.taskId, descripIdArr) >= 0 && $.inArray(task.locId, locIdArr) >= 0 && filterPicklists(task));
else if(ownerIdArr.length > 0 && descripIdArr.length > 0 && picklistIdArr.length > 0 && dateIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && $.inArray(task.taskId, descripIdArr) >= 0 && filterPicklists(task) && $.inArray(task.taskId, dateIdArr) >= 0);
else if(ownerIdArr.length > 0 && descripIdArr.length > 0 && locIdArr.length > 0 && dateIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && $.inArray(task.taskId, descripIdArr) >= 0 && $.inArray(task.location, locIdArr) >= 0 && $.inArray(task.taskId, dateIdArr) >= 0);
else if(descripIdArr.length > 0 && locIdArr.length > 0 && picklistIdArr.length > 0 && dateIdArr.length > 0)
return ($.inArray(task.taskId, descripIdArr) >= 0 && $.inArray(task.location, locIdArr) >= 0 && filterPicklists(task) && $.inArray(task.taskId, dateIdArr) >= 0);
else if(locIdArr.length > 0 && picklistIdArr.length > 0 && dateIdArr.length > 0 && descripIdArr.length > 0)
return ($.inArray(task.location, locIdArr) >= 0 && filterPicklists(task) && $.inArray(task.taskId, dateIdArr) >= 0 && $.inArray(task.taskId, descripIdArr) >= 0);
else if(locIdArr.length > 0 && ownerIdArr.length > 0 && picklistIdArr.length > 0 && dateIdArr.length > 0)
return ($.inArray(task.location, locIdArr) >= 0 && getInvitedUsers(task, ownerIdArr) && filterPicklists(task) && $.inArray(task.taskId, dateIdArr) >= 0);
//Check 3 filters
else if(ownerIdArr.length > 0 && descripIdArr.length > 0 && picklistIdArr.length > 0)
return ($.inArray(task.taskId, descripIdArr) >= 0 && getInvitedUsers(task, ownerIdArr) && filterPicklists(task));
else if(ownerIdArr.length > 0 && locIdArr.length > 0 && picklistIdArr.length > 0)
return ($.inArray(task.location, locIdArr) >= 0 && getInvitedUsers(task, ownerIdArr) && filterPicklists(task));
else if(descripIdArr.length > 0 && picklistIdArr.length > 0 && locIdArr.length > 0)
return ($.inArray(task.location, locIdArr) >= 0 && $.inArray(task.taskId, descripIdArr) >= 0 && filterPicklists(task));
else if(ownerIdArr.length > 0 && descripIdArr.length > 0 && locIdArr.length > 0)
return ($.inArray(task.location, locIdArr) >= 0 && $.inArray(task.taskId, descripIdArr) >= 0 && getInvitedUsers(task, ownerIdArr));
else if(ownerIdArr.length > 0 && descripIdArr.length > 0 && dateIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && $.inArray(task.taskId, descripIdArr) >= 0 && $.inArray(task.taskId, dateIdArr) >= 0);
else if(ownerIdArr.length > 0 && locIdArr.length > 0 && dateIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && $.inArray(task.location, locIdArr) >= 0 && $.inArray(task.taskId, dateIdArr) >= 0);
else if(ownerIdArr.length > 0 && picklistIdArr.length > 0 && dateIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && filterPicklists(task) && $.inArray(task.taskId, dateIdArr) >= 0);
else if(descripIdArr.length > 0 && locIdArr.length > 0 && dateIdArr.length > 0)
return ($.inArray(task.taskId, descripIdArr) >= 0 && $.inArray(task.location, locIdArr) >= 0 && $.inArray(task.taskId, dateIdArr) >= 0);
else if(descripIdArr.length > 0 && picklistIdArr.length > 0 && dateIdArr.length > 0)
return ($.inArray(task.taskId, descripIdArr) >= 0 && filterPicklists(task) && $.inArray(task.taskId, dateIdArr) >= 0);
else if(picklistIdArr.length > 0 && locIdArr.length > 0 && dateIdArr.length > 0)
return (filterPicklists(task) && $.inArray(task.location, locIdArr) >= 0 && $.inArray(task.taskId, dateIdArr) >= 0);
//Check 2 filters
else if(ownerIdArr.length > 0 && dateIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && $.inArray(task.taskId, dateIdArr) >= 0);
else if(descripIdArr.length > 0 && dateIdArr.length > 0)
return ($.inArray(task.taskId, descripIdArr) >= 0 && $.inArray(task.taskId, dateIdArr) >= 0);
else if(locIdArr.length > 0 && dateIdArr.length > 0)
return ($.inArray(task.location, locIdArr) >= 0 && $.inArray(task.taskId, dateIdArr) >= 0);
else if(picklistIdArr.length > 0 && dateIdArr.length > 0)
return (filterPicklists(task) && $.inArray(task.taskId, dateIdArr) >= 0);
else if(ownerIdArr.length > 0 && descripIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && $.inArray(task.taskId, descripIdArr) >= 0);
else if(ownerIdArr.length > 0 && locIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && $.inArray(task.location, locIdArr) >= 0);
else if(descripIdArr.length > 0 && locIdArr.length > 0)
return ($.inArray(task.taskId, descripIdArr) >= 0 && $.inArray(task.location, locIdArr) >= 0);
else if(descripIdArr.length > 0 && picklistIdArr.length > 0)
return ($.inArray(task.taskId, descripIdArr) >= 0 && filterPicklists(task));
else if(ownerIdArr.length > 0 && picklistIdArr.length > 0)
return (getInvitedUsers(task, ownerIdArr) && filterPicklists(task));
else if(locIdArr.length > 0 && picklistIdArr.length > 0)
return ($.inArray(task.location, locIdArr) >= 0 && filterPicklists(task));
//Else, only check for 1 filter
else if(picklistIdArr.length > 0)
return filterPicklists(task);
else if(descripIdArr.length > 0)
return $.inArray(task.taskId, descripIdArr) >= 0;
else if(ownerIdArr.length > 0 || groupIdArr.length > 0)
return getInvitedUsers(task, ownerIdArr);
else if(locIdArr.length > 0)
return $.inArray(task.location, locIdArr) >= 0;
else if(dateIdArr.length > 0)
return filterPicklists(task);
else
return false;
}
});
}
The problem is... This runs after ANY change to ANY kendo widget. Changing the scheduler view makes the filter run for every task (event), when I create/edit an event, the filter runs after I click out of EVERY field in the editor/creator (which I don't get... no filtering should be happening in the create/edit popup... only after clicking save I would think...)
The filter running so much is problematic because it runs for EVERY event... so if I have 1000+ events.......... the scheduler just drags horribly and operates so slowly.
Is there anything to be done to speed this up?
I have validation list on some of my cells as demonstrated here:
http://dojo.telerik.com/@marclazell/UcAVu
Is there a way to stop the users removing the value completely? They can delete it manually and no warning message appears.
Thanks!
Hi,
I want to set Kendo Razor Gantt Height to 100%. But This only occurs when I resize my window, otherwise is my Gantt not 100%
<script type=
"text/javascript"
>
$(document).ready(
function
() {
changeWidth();
});
window.onresize =
function
(event) {
changeWidth()
}
function
changeWidth() {
var
element = document.getElementById(
"gantt"
);
var
height = 0;
var
body = window.document.body;
if
(window.innerHeight) {
height = window.innerHeight;
}
else
if
(body.parentElement.clientHeight) {
height = body.parentElement.clientHeight;
}
else
if
(body && body.clientHeight) {
height = body.clientHeight;
}
element.style.height = ((height - element.offsetTop - 150) +
"px"
);
console.log(height);
}
<script>
Please let know what am i missing. Thanks in advance.
Is it possible to let the spreadsheet input cell accepts comma's instead of decimal in use of formulars ?
ex =E3*1,1 which trigger my validation that use the function ISNUMBER. =E3*1.1 works fine. So I believe that the ISNUMBER function only accepts US numberformat ?
In the attached files, categories are the Group field, and bars are stacked according to the Response field.
Values for the 2-Neutral and 3-Agree groups display correctly in the right category. Values for the first group of 1-Disagree are in the wrong order. They should be 12.5, 16.2, 19.8, 24.8 and 24.7. The second value shows at the bottom of the chart in the fifth 5-20+ years category, instead of in the second 2 to less than 5 years category.
Can you help me resolve this problem?
Thanks very much for your help.
Chris
I am looking to display several series on a line chart. Each series comes from a different datasource, but I have normalized them client-side to ensure there are the correct number of values for the category axis. I am trying to bind to a custom value field in the series. Below is one example of my attempt and I think illustrates well what I am trying to do. Is this possible?
01.
<!DOCTYPE html>
02.
<
html
>
03.
<
head
>
04.
<
meta
charset
=
"utf-8"
/>
05.
<
title
>Kendo UI Snippet</
title
>
06.
07.
<
link
rel
=
"stylesheet"
href
=
"http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.common.min.css"
/>
08.
<
link
rel
=
"stylesheet"
href
=
"http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.rtl.min.css"
/>
09.
<
link
rel
=
"stylesheet"
href
=
"http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.silver.min.css"
/>
10.
<
link
rel
=
"stylesheet"
href
=
"http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.mobile.all.min.css"
/>
11.
12.
<
script
src
=
"http://code.jquery.com/jquery-1.12.4.min.js"
></
script
>
13.
<
script
src
=
"http://kendo.cdn.telerik.com/2017.1.118/js/kendo.all.min.js"
></
script
>
14.
</
head
>
15.
<
body
>
16.
17.
<
div
id
=
"chart"
></
div
>
18.
<
script
>
19.
var data = [
20.
{name:'Series 1',
21.
//data:[-1, 1, null, 1.2, .8, null, 2, -2],
22.
data:[{Id:1, Value:-1, Year:2010}, {Id:2, Value:2, Year:2011}, {Id:3, Value:null, Year:2012}, {Id:4, Value:4, Year:2013}],
23.
field:'data.Value',
24.
color:'red'
25.
},
26.
{name:'Series 2',
27.
data:[{Id:1, Value:1, Year:2010}, {Id:2, Value:3, Year:2011},
{Id:3, Value:5, Year:2012}, {Id:4,Value:7, Year:2013}],28.
field:'data.Value',
29.
color:'green'
30.
},
31.
]
32.
$("#chart").kendoChart({
33.
dataSource: {
34.
data: data
35.
},
36.
seriesDefaults: {
37.
type: "line",
38.
missingValues:'interpolate',
39.
stack:true,
40.
field:'data.Value'
41.
},
42.
series: data
43.
});
44.
</
script
>
45.
</
body
>
46.
</
html
>
Hi,
I'm try disabled fiels in the dynamically grid, find a exaple in kendo demo but i can't goal.
This is exaple:
<
script
>
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{
field: "salary",
editable: function (dataItem) {
return dataItem.name === "Jane";
}
}
],
editable: true,
dataSource: [ { name: "Jane", salary: 2000 }, { name: "Bill", salary: 2000 } ]
});
</
script
>
This is my code, in the generateColumns method i want to do that:
loadGridDetails(url: string, nameGrid: string) {
$("#" + nameGrid).empty();
$.getJSON(url)
.done(data => {
let columns = this.generateColumns(data[0]);
$("#" + nameGrid).kendoGrid({
dataSource: {
data: data,
pageSize: 10,
dataValueField: "key",
dataTextField: "value"
},
scrollable: false,
pageable: {
input: true,
numeric: false
},
sortable: true,
navigatable: true,
columns: columns,
editable: true,
resizable: true
});
let grid = $("#" + nameGrid).data("kendoGrid");
//grid.columns[1].attributes = { editable: false };
grid.hideColumn(grid.columns[0]);
grid.hideColumn(grid.columns[2]);
})
.fail((jqxhr, textStatus, error) => {
let err = textStatus + ", " + error;
alert("Respuesta fallida: \n" + url + "\n " + err);
});
}
generateColumns(dataItem) {
let columns = [];
for (var propt in dataItem) {
debugger;
columns.push({
field: propt
});
}
columns.push({
command: [{
className: "btn-danger",
name: "destroy",
text: "Eliminar"
}], attributes: {
"class": "text-center"
}
});
return columns;
}
Hello,
I'm having slow performance in spreadsheet validation.
var sheets = $("#spreadsheet").data("kendoSpreadsheet").sheets();
var colPromiseDate = sheets .activeSheet().range("C2:C" + sheets.activeSheet()._rows._count);
colPromiseDate.format("MM/dd/yyyy");
colPromiseDate.validation({
dataType: "date",
showButton: true,
allowNulls: true,
type: "reject",
comparerType: "between",
from: "01/01/2000",
to: "01/01/2099",
titleTemplate: "Date validaton error",
messageTemplate: "Invalid Date"
});
I had debug the script, only this part will affect the performance of the page.
My spreadsheet have 200 rows which get from kendo grid data source, so I can't do it in sheets.rows.cell validation.
FYI, I have tried to use for loop to put in validation on each cell, but the result is still the same.
Please advice..
Thanks.
Regards,
Su Pei
I have a line chart which can be configured to show data from the last month, last 3 months, ... , last 2 years, last 10 years, etc.
In my SQL query I filter the data to return only the last X months and provide this data to the Kendo chart.
I am using ChartAxisBaseUnit.Fit so I can return data over weeks, months, years and the date axis is adjusted accordingly.
It is now March 16th, if I return 6 months of data the chart will show Months (September to March) on the data axis.
The problem is that we are only half way through March so the line drops off as we do not have all the data for that month yet.
What I could do is filter the data in SQL to only return complete months... i.e. filter the data from 1st September to 1st March.
However, if I return data over a longer period of time the chart will automatically show Years on the date axis.
In this case I don't want to show 2017 at all so I want to ignore any data from Jan and Feb 2017 causes.
Hopefully you get the problem... if date axis is showing years, months, weeks then I only want to show data for the last complete year, month, week.
I have seen there is a MaxDateGroups property that can be set to control the number of items shown but that does not really help.
Eventually I want the user to be able to select a custom date range and show a line chart with automatically scaled date axis.
However, I don't want the line chart to suddenly drop down at the end because we are on the first day of the month, etc.
I am hoping I am just missing something simple here and there is some property which I can set?
If not how have other people got around this problem? I would expect this is a common issue.
Hi,
Sometimes the filter button does not highlight that a filter is active. You can see from the screenshot that some rows are filtered. (Missing row numbers indicate this). The filter column is H, however the filter button has not changed colour.
I have tested with column B and the filter column changes for this column.
Thanks
Marc