I am following the directions for batch editing mode here:
https://demos.telerik.com/aspnet-mvc/grid/editing
When I disable server operation, I assume I am getting a LOT of records back from the database (50K+) and this is causing the following error: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
How can I use ServerOperation for Paging/Sorting/Filtering functionality, but still use Batch with InCell editing mode?
Controller Code:
public
ActionResult Contacts_Read([DataSourceRequest]DataSourceRequest request)
{
var dbcontext =
new
CRMDataModel2();
IQueryable<vw_CRM_GetCompanyContacts> contacts = dbcontext.vw_CRM_GetCompanyContacts;
DataSourceResult result = contacts.ToDataSourceResult(request, contact =>
new
{
Comp_Secterr = contact.Comp_SecTerr,
PersonLinkId = contact.PersonLinkId,
Office = contact.Office,
Company = contact.Company,
Year = contact.Year,
Branch = contact.Branch,
Supervisor = contact.Supervisor,
AccountManager = contact.AccountManager,
Contact = contact.Contact,
Role = contact.Role,
NPS = (
bool
)contact.NPS,
Statement = (
bool
)contact.Statement,
Invoices = (
bool
)contact.Invoices,
FieldReport = (
bool
)contact.FieldReport,
RainContact = (
bool
)contact.RainContact,
});
return
Json(result);
}
//grid is set to incell editing
.Ed
table(editable => editable.Mode(GridEditMode.InCell))
//data source is set to server operation false, batch trueDataSource(dataSource =>
dataSource.Ajax()
.ServerOperation(
false
)
.Batch(
true
)
.Read(read => read.Action(
"Contacts_Read"
,
"ContactMaintenance"
))
.Update(update => update.Action(
"Contacts_Update"
,
"ContactMaintenance"
))
.Destroy(destroy => destroy.Action(
"Contacts_Destroy"
,
"ContactMaintenance"
))
//...omitted for brevity
i notice that my multi-select filter on my grid does not have a Select all checkbox as I have seen in the multi-filter checkbox demo -
I am using the asp.mvc version visual studio version 15.8.1 -
To see this, create new telerik mvc core project using the grid template
which has this grid
<div class="row">
<div class="col-xs-18 col-md-12">
@(Html.Kendo().Grid<TelerikAspNetCoreApp1.Models.OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}");
columns.Bound(p => p.ShipName);
columns.Bound(p => p.ShipCity);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
</div>
</div>
add this to the freight column
Filterable(ftb => ftb.Multi(true))
the resulting filter has no select all checkbox as shown in this demo
https://demos.telerik.com/aspnet-mvc/grid/filter-multi-checkboxes
can you look into this and see what is going on
thanks
Jim
Hi,
I've spent my whole day searching for a way of reloading a scheduler's resources and data from a javascript function. So far I've reduced my code to:
var
scheduler = $(
"#MyScheduler"
).data(
"kendoScheduler"
);
scheduler.resources[0].dataSource.read();
scheduler.dataSource.read();
My code calls the correct methods against the controller and the new data is returned. However, the new resources are not displayed correctly. A very similar problem found here: https://www.telerik.com/forums/modifying-resources-datasource-dynamically.
As stated in the above post, "modifying the scheduler resources after it's initialization is not supported". It's also recommended that the scheduler should be destroyed and re-initialize. Nencho also provides a link to http://dojo.telerik.com/egoq which shows a jQuery method of doing so.
can someone provide me with an MVC example of doing so?
I've got a horrible feeling that I need to call the action methods in the controller manually. There must be a better way...
Here's my RazorView set up of my .
@(Html.Kendo().Scheduler<
AlternativeViewModel
>()
.Name("AlternativeScheduler")
.Date(Model.TargetDate.GetValueOrDefault(DateTime.Today).Date)
.StartTime(new DateTime(2015, 03, 31, 00, 00, 00))
.EndTime(new DateTime(2015, 03, 31, 23, 59, 59))
.Selectable(true)
.MajorTick(1440)
.MinorTickCount(1)
.AllDaySlot(true)
.CurrentTimeMarker(false)
.Height(720)
.EventTemplate(
"<
div
style
=
text
-align:center> " +
"<
p
style
=
'margin-top: 4px'
>#= title #</
p
>" +
"<
p
>" +
"#= kendo.toString(ShiftStart, 'HH:mm') # - #= kendo.toString(ShiftEnd,'HH:mm') #" +
"</
p
>" +
"</
div
>")
.Editable(editable =>
{
editable.TemplateId("SchedulerEditorAlt");
editable.Destroy(false);
})
.Views(views =>
{
views.TimelineWeekView(timeline => timeline.EventHeight(80).Title("Week").Selected(true))
.Footer(false)
.ShowWorkHours(false)
.DateHeaderTemplate("#=kendo.toString(date, 'ddd dd MMM')# ");
})
.Timezone(Model.TimeZone)
.CurrentTimeMarker(c => c.UseLocalTimezone(false))
.Group(group => group.Resources("ServiceName").Orientation(SchedulerGroupOrientation.Vertical))
.Events(e =>
{
e.ResizeEnd("Roster.onResizeEndAlt");
e.Edit("Roster.onEditEventAlt");
e.Save("Roster.onSaveAlt");
e.Cancel("Burger.onClose");
e.DataBound("Burger.onAltDataBound");
e.MoveEnd("Burger.onMoveEndAlt");
e.Navigate("Burger.onAltNavigate");
e.Change("Burger.onSchedulerChangeAlt");
})
.Resources(resource => resource
.Add(m => m.ShiftPatternId)
.Title("ServiceName")
.Name("ServiceName")
.Multiple(true)
.DataTextField("ServiceName")
.DataValueField("ShiftPatternId")
.DataColorField("Color")
.DataSource(source => source
.Read(read => read
.Action("GetServiceNames", "Scheduler").Type(HttpVerbs.Post)
.Data("Burger.getSchedulerDataWithFormat")
)
)
)
.Resources(resource => resource
.Add(m => m.Status)
.Title("ShiftStatusId")
.Name("Status")
.DataTextField("WorkerName")
.DataValueField("BurgerStatusId")
.DataColorField("Color")
.DataSource(source => source
.Read(read => read
.Action("GetShiftStatusResources", "Scheduler")
.Data("Burger.getSchedulerDataWithoutDateCheck")
)
)
)
.DataSource(d => d
.Model(m =>
{
m.Id(f => f.XmlId);
m.Field(f => f.ServiceName).DefaultValue("No title");
m.Field(f => f.SuggestedUserName);
m.Field(f => f.Status);
})
.Read(read => read
.Action("AlternativeSchedulerRead", "Scheduler")
.Data("Burger.getSchedulerDataWithoutDateCheck")
)
.ServerOperation(true)
)
)
Thanks in advance,
Paul
I have a VS2013 telerik mvc project and I have added a Class Library Project which has my DB models. I have already add the reference to my telerik mvc project but when I select the Kendo UI Scaffolding and select one of muy models inside de Class Library Project it always says:
'There was an error running the selected code generator 'Invalid Model Configuration'
but I don't know what I'm missing. I'm using entity framework 5.0.0 with as the model generator.
If someone has any idea I'll appreciate it.
How can I pass data from the client to the Read action for a MultiSelect using virtualization. Here is the declaration of the MultiSelect I'm using:
@(Html.Kendo().MultiSelectFor(model => model.SelectedProjectIds)
.Filter(FilterType.StartsWith)
.DataTextField("Name")
.DataValueField("Id")
.HtmlAttributes(new { style = "width: 100%" })
.Placeholder("- Select Project(s) -")
.DataSource(source =>
{
source.Custom()
.ServerFiltering(true)
.ServerPaging(true)
.PageSize(80)
.Type("aspnetmvc-ajax")
.Transport(transport =>
{
transport.Read("ProjectRead", "ProjectPlan");
})
.Schema(schema =>
{
schema.Data("Data")
.Total("Total");
});
})
.Virtual(v => v.ItemHeight(26))
)
I'd like to pass in some data in the Transport Read. Here is the action method for the Read:
[HttpPost]
public ActionResult ProjectRead([DataSourceRequest] DataSourceRequest request)
{
return Json((GetProjects() as List<NamedEntity>).ToDataSourceResult(request));
}
So, in addition to the DataSourceRequest object, I'd like to pass in a string from the client-side. How can this be done?
Hello,
I can get the multi filter to display or I can get the row filtering but I can't get both at once. My client is an excel experience heavy user and say the grid displays 700 records. They then want the ability to row filter and say that reduces it down to 350. Then they want to apply column value multi select filters to narrow the 350 down even further.
However I have tried a couple different combinations and while they don't error out I don't get both filters on one grid.
One attempt:
@(Html.Kendo().Grid(Model)
.Name(
"grid"
)
.Columns(columns =>
{
columns.Bound(e => e.A).Filterable(ftb => ftb.Multi(
true
).Search(
true
));
columns.Bound(e => e.B).Filterable(ftb => ftb.Multi(
true
).Search(
true
));
columns.Bound(e => e.C).Filterable(ftb => ftb.Multi(
true
).Search(
true
));
columns.Bound(e => e.D).Filterable(ftb => ftb.Multi(
true
).Search(
true
));
columns.Bound(e => e.E).Filterable(ftb => ftb.Multi(
true
).Search(
true
));
})
.HtmlAttributes(
new
{ style =
"width: 80%;"
})
.DataSource(data => data.Ajax().Model(mdl => mdl.Id(p => p.A) ))
.Scrollable()
.Groupable()
.Sortable()
.Editable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.Resizable(size => size.Columns(
true
))
.Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
.Pageable(pageable => pageable
.Refresh(
true
)
.PageSizes(
true
)
.ButtonCount(5))
)
Another attempt:
@(Html.Kendo().Grid(Model)
.Name(
"grid"
)
.Columns(columns =>
{
columns.Bound(e => e.A).Filterable(ftb => ftb.Multi(
true
).Search(
true
)).Filterable(ftb => ftb.Mode(GridFilterMode.Row));
columns.Bound(e => e.B).Filterable(ftb => ftb.Multi(
true
).Search(
true
));
columns.Bound(e => e.C).Filterable(ftb => ftb.Multi(
true
).Search(
true
));
columns.Bound(e => e.D).Filterable(ftb => ftb.Multi(
true
).Search(
true
));
columns.Bound(e => e.E).Filterable(ftb => ftb.Multi(
true
).Search(
true
));
})
.HtmlAttributes(
new
{ style =
"width: 80%;"
})
.DataSource(data => data.Ajax().Model(mdl => mdl.Id(p => p.A) ))
.Scrollable()
.Groupable()
.Sortable()
.Editable()
.Filterable()
.Resizable(size => size.Columns(
true
))
.Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
.Pageable(pageable => pageable
.Refresh(
true
)
.PageSizes(
true
)
.ButtonCount(5))
)
Thoughts?
JB
I am getting this error "The Type or Namespace name ' GridAction' could not be found" while upgrading the application from version 2011.2.712 to 2018.3.1017.
Please let me know how to solve this error.