Hi;
I'm newbie to core and trying progress controls. I'm using razor pages and i couldn't find any sample about selecteditemchanged event usage for filling other controls from db.
Is it possible to give a short sample? If filling can be done serverside will be more happy :)
Thanks
How do you remove the "Add Task" button? My Gantt chart is completely driven from database values, so I don't want my users to be able to add tasks to the Gantt, they only need to see schedule.
Thanks
Ken
Hi,
I want to develop an editable grid using kendo in Asp.net core 2.
I am trying to install nuget package kendo grid in asp.net core 2
Kendo.MVC.UI
Kendo.MVC
However i am not able to get the through.
I am getting following version conflict.
Package Kendo.Mvc 2016.1.112 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Kendo.Mvc 2016.1.112 supports:
Can you please help me with some demo version if its available.
Good morning,
I'm working on an web application and I was wondering the best way to go about initializing a prefiltered grid. Users see a flowchart of different statuses of a product, if they click on one of the statuses I would like it to go to the grid that I have with the status column filtered with the status that they selected.
I thought the best way to do this would be to create a separate method in the controller for each status, but that seemed a little clunky.
I currently have the status column as
columns.Bound(c => c.Status).Width(150)
.Title(
"Status"
)
.Filterable(filterable => filterable
.Cell(cell => cell
.ShowOperators(
false
)
.InputWidth(150)
.Operator(
"contains"
)
.SuggestionOperator(FilterType.Contains)
.Template(
"statusFilter"
)
)
);
function
statusFilter (element) {
element.element.kendoDropDownList({
dataSource: {
dataType:
"json"
,
transport: {
read:
"@Url.Action("
Status_Filter
", "
Controller
")"
}
},
optionLabel:
"--Select Status--"
});
}
Would I need to change how I have my filtering? Would you know how to do this?
Basic sample from https://demos.telerik.com/aspnet-core/autocomplete/index displays this in chrome console:
VM591:1 Uncaught TypeError: jQuery(...).kendoAutoComplete is not a function
....
Kendo UI is working fine for every control except autocomplete. There are multiple controls on this page besides the autocomplete.. Even the basic asp.net core demos do not work at all. What extra configuration steps are needed to actually get this to work? I also noticed that much of the samples have big chunks of code missing, such as the virtualization demo.
Hello!
Could you please provide this Kendo UI for jQuery example implemented with ASP.NET Core tag helpers? https://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Templates/grid-with-checkbox-column
For some reason I can't get it to work properly. Does this work with batch editing and inline editing?
Best regards,
Kaan
Using .NET Core, have a grid bound to a local data source. We are adding a similar item after selecting via a multiselect control. We have this working, however when we add it to the bound data source, any CSS changes we may have made to other rows disappear. We are trying to make it so the CSS is either retained on the existing row or where we can restore it via an "item data bound" like event.
From the code below, I'm assuming the changed event on the data source occurs before the grid is rebound. And I cannot seem to identify a valid event on the grid for after the grid has been rebound to restore any CSS placed from the remove command.
Grid:
<kendo-grid name="TaskGrid" persist-selection="true" selectable="single row" height="300" datasource-id="gridDataSource" on-page="LoadRoleToTask()">
<columns>
<column hidden="true" field="TaskId" />
<column title="Task" field="TaskName" />
<column>
<commands>
<column-command name="Remove" click="RemoveTask" text="Remove"></column-command>
</commands>
</column>
</columns>
<groupable enabled="false" />
<sortable enabled="true" allow-unsort="false" initial-direction="ascending" />
<filterable enabled="true" />
</kendo-grid>
Javascript:
var gridDataSource = new kendo.data.DataSource({ change: AddCSS });
function LoadRoleToTask()
{
@foreach(var r2t in Model.RoleToTasks)
{
<text>
var roleToTask =
{
TaskId: "@r2t.TaskId",
TaskName: "@r2t.TaskName",
IsDeleted: false
};
gridDataSource.add(roleToTask);
</text>
}
}
function AddCSS(e)
{
var grid = $("#TaskGrid").data("kendoGrid");
if (!grid) return;
var headerCells = grid.element.find("th");
for (var row = 0; row < grid.dataSource.total(); row++)
{
var dataItem = grid.dataSource.at(row);
var rowCells = grid.element.find("tr[data-uid=" + dataItem.uid + "] td");
var currentTask = FindTask(dataItem.TaskId);
if (!currentTask.isDeleted) continue;
for (var i = 1; i < headerCells.length; i++)
{
var cell = $(rowCells[index]);
cell.addClass("deletedRole");
}
}
}
function AddTask()
{
var multi = $("#TaskMultiSelect").getKendoMultiSelect();
var multiDataItems = multi.dataItems();
if (multiDataItems.length == 0) return;
for (var i = 0; i < multiDataItems.length; i++)
{
var selectedTask = multiDataItems[i];
var currentTask = FindTask(selectedTask.TaskId);
if (currentTask) continue; //if already in data source, don't re-add
var newRole =
{
TaskId: selectedTask.TaskId,
TaskName: selectedTask.Name,
IsDeleted: false
};
gridDataSource.add(newRole); //successful but removes any CSS already in place
}
}
function RemoveTask(e)
{
e.preventDefault();
var grid = $("#TaskGrid").data("kendoGrid");
var headerCells = grid.element.find("th");
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var rowCells = grid.element.find("tr[data-uid=" + dataItem.uid + "] td");
var currentTask = FindTask(dataItem.TaskId);
if (!currentTask.IsDeleted)
{
currentTask.IsDeleted = true;
e.target.innerText = "Undo";
for (var index = 1; index < headerCells.length; index++)
{
var cell = $(rowCells[index]);
cell.addClass("deletedRole");
}
}
else
{
currentTask.IsDeleted = false;
e.target.innerText = "Remove";
for (var index = 1; index < headerCells.length; index++)
{
var cell = $(rowCells[index]);
cell.removeClass("deletedRole");
}
}
}
function FindTask(taskId)
{
for (var i = 0; i < gridDataSource.data().length; i++)
{
var currentTask = gridDataSource.data()[i];
if (currentTask && currentTask.TaskId == taskId)
{
return currentTask;
}
}
}
Hi
I am new to Telerik, can someone point me to a sample of using Scheduler in Razor Page with EF data? I am not using Controller but code behind for Razor Page.
thanks in advance.
Hello,
I am trying to use the Scheduler control for my application. I have it reading the data from my controller fine. However, I cannot get it call the HttpPut handler correctly.
My breakpoint isnt hit & checking the traffic the responce is:
400 - Bad Request
{"":["The input was not valid."]}
The code I am using for the UI is:
01.
@(Html.Kendo().Scheduler<MeetingViewModel>()
02.
.Name(
"SchedulerView"
)
03.
.Height(500)
04.
.Date(DateTime.Now.ToUniversalTime())
05.
.StartTime(
new
DateTime(2018, 11, 28, 0, 00, 00).ToUniversalTime())
06.
.MajorTick(30)
07.
.ShowWorkHours(
false
)
08.
.Footer(
false
)
09.
.Editable(edit =>
10.
{
11.
//edit.Resize(false);
12.
edit.Create(
false
);
13.
})
14.
.Views(views =>
15.
{
16.
views.TimelineView(timeline => timeline.EventHeight(50));
17.
//views.TimelineWeekView(timeline => timeline.EventHeight(50));
18.
//views.TimelineWorkWeekView(timeline => timeline.EventHeight(50));
19.
//views.TimelineMonthView(timeline =>
20.
//{
21.
// timeline.StartTime(DateTime.Now);
22.
// timeline.EndTime(DateTime.Now.AddMonths(1));
23.
// timeline.MajorTick(1440);
24.
// timeline.EventHeight(50);
25.
//});
26.
27.
})
28.
.Timezone(
"Etc/UTC"
)
29.
.Group(group => group.Resources(
"WorkCenters"
/*,"Attendees"*/
).Orientation(SchedulerGroupOrientation.Vertical))
30.
.Resources(resource =>
31.
{
32.
resource.Add(m => m.ScheduleRowID)
33.
.Title(
"Work Center"
)
34.
.Name(
"WorkCenters"
)
35.
.DataTextField(
"Text"
)
36.
.DataValueField(
"Value"
)
37.
.DataColorField(
"Color"
)
38.
.BindTo(@Model.AvailableWorkCenters);
39.
})
40.
.DataSource(d => d
41.
.ServerOperation(
true
)
42.
.WebApi()
43.
.Model(m =>
44.
{
45.
m.Id(f => f.ActivityID);
46.
m.Field(f => f.Title).DefaultValue(
"No title"
);
47.
//m.RecurrenceId(f => f.RecurrenceID);
48.
m.Field(f => f.Description).DefaultValue(
"No Description"
);
49.
})
50.
.Events(events => events.Error(
"error_handler"
))
51.
.Read(read => read.Action(
"GetActivities"
,
"Scheduler"
).Data(
"setRequestDateTimes"
))
52.
//.Create(create => create.Action("Post", "Scheduler"))
53.
.Update(update => update.Action(
"PutActivity"
,
"Scheduler"
,
new
{ id =
"{0}"
}))
54.
//.Destroy(destroy => destroy.Action("Delete", "Scheduler", new { id = "{0}" }))
55.
)))
The code I am using for the Controller is:
01.
[Route(
"Api/[controller]"
)]
02.
[ApiController]
03.
public
class
SchedulerController : DawnController
04.
{
05.
public
SchedulerController(DatabaseContext context) :
base
(context)
06.
{
07.
}
08.
09.
[HttpGet]
10.
public
DataSourceResult GetActivities([DataSourceRequest] DataSourceRequest request, DateTime requestStartDateTime, DateTime requestEndDateTime)
11.
{
12.
//Kendo doesnt seem to send the full date range. so + 1 day to end
13.
requestEndDateTime = requestEndDateTime.AddDays(1);
14.
15.
List<MeetingViewModel> test =
new
List<MeetingViewModel>();
16.
17.
//List<JobTask> Tasks =
18.
// Context.JobTask.Where(j => JobTask.HasActivityInDateRange(j, requestStartDateTime, requestEndDateTime)).ToList();
19.
20.
//foreach (JobTask jobTask in Tasks)
21.
//{
22.
// foreach (Activites jobTaskAct in jobTask.Activites)
23.
// {
24.
// test.Add(new MeetingViewModel()
25.
// {
26.
// JobTaskID = jobTask.JobTaskId,
27.
// ActivityID = jobTaskAct.ActivityId,
28.
// Title = jobTaskAct.Name,
29.
// Description = jobTaskAct.Description,
30.
// Start = jobTaskAct.StartTime,
31.
// End = jobTaskAct.EndTime,
32.
// IsAllDay = false,
33.
// ScheduleRowID = jobTaskAct.Workcenter.WorkCenterId,
34.
// });
35.
// }
36.
//}
37.
38.
foreach
(JobTask jobTask
in
Context.JobTask)
39.
{
40.
if
(JobTask.HasActivityInDateRange(jobTask, requestStartDateTime, requestEndDateTime))
41.
{
42.
foreach
(Activites jobTaskAct
in
jobTask.Activites)
43.
{
44.
test.Add(
new
MeetingViewModel()
45.
{
46.
JobTaskID = jobTask.JobTaskId,
47.
ActivityID = jobTaskAct.ActivityId,
48.
Title = jobTaskAct.Name,
49.
Description = jobTaskAct.Description,
50.
Start = jobTaskAct.StartTime.ToUniversalTime(),
51.
End = jobTaskAct.EndTime.ToUniversalTime(),
52.
IsAllDay =
false
,
53.
ScheduleRowID = jobTaskAct.Workcenter.WorkCenterId,
54.
});
55.
}
56.
}
57.
}
58.
return
test.ToDataSourceResult(request);
59.
}
60.
61.
62.
[HttpPut(
"{id}"
)]
63.
public
IActionResult PutActivity(
int
id, MeetingViewModel task)
64.
{
65.
if
(ModelState.IsValid && id == task.ActivityID)
66.
{
67.
try
68.
{
69.
//breakpoint here
70.
bool
a =
true
;
71.
//update the db here
72.
}
73.
catch
(DbUpdateConcurrencyException)
74.
{
75.
return
new
NotFoundResult();
76.
}
77.
78.
return
new
StatusCodeResult(200);
79.
}
80.
else
81.
{
82.
return
BadRequest(ModelState.Values.SelectMany(v => v.Errors).Select(error => error.ErrorMessage));
83.
}
84.
}
85.
}
What could be the issue for me?
Hi!
Example: https://demos.telerik.com/aspnet-core/grid/editing
When the user changes the first product name from "Chai" to "Chai2", and then back again to "Chai" without clicking on "Save changes", the dirty flag stays visible, and unchanged data is transferred to the server when clicking on "Save changes".
Is it possible to change this grid editing behaviour? In comparison, in inline editing mode, data is sent to the server when clicking on "Update" only when the data has really changed.
Best regards,
Kaan