I've been trying to implement cell-based editing into my grid. It does work in a fashion, in that I can edit the current values present in the grid and they do save when clicking the Save Changes button. However, it does not appear to be firing the Update function correctly, which points to a function in the Controller. I know the grid is able to fire events for Read since I've applied a filter which uses a function in the Controller, and it's able to call that function without problems. It just doesn't seem to fire the Update function.
Below is the code for the table;
@{Layout =
null
;}
@(Html.Kendo().Grid<FiveSReporting.Models.ViewModels.SchedulingViewModel>()
.Name(
"Schedule"
)
.Columns(columns =>
{
columns.Bound(c => c.LineName);
columns.Bound(c => c.WeekOfFirst);
columns.Bound(c => c.WeeksBetweenEach);
})
.ToolBar(t => { t.Save(); })
.Pageable()
.Editable(e => e.Mode(GridEditMode.InCell))
.Sortable(sortable =>
{
sortable.SortMode(GridSortMode.SingleColumn);
})
.Scrollable(scrollable => scrollable.Enabled(
false
))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(
true
)
.ServerOperation(
false
)
.Events(e => e.Error(
"error_handler"
))
.Model(m => { m.Id(s => s.ID); m.Field(s => s.LineName).Editable(
false
); })
.Update(update => update.Action(
"Schedule_Write"
,
"ScheduleAdminTwo"
))
.Read(read => read.Action(
"Schedule_Read"
,
"ScheduleAdminTwo"
)
.Data(
"getSchedule"
))
)
.AutoBind(
false
)
)
I've also found that when clicking on the Cancel Changes button that it will throw an error to the console, and subsequent attempts to navigate on the grid also throw errors.This occurs when you click the Cancel Changes button just after clicking the Save Changes button. See attached screenshot for details.
Thank you ahead of time for your assistance.
Hi,I have something like this in my _LayoutStandard.html for an ASP.NET MVC5 site:
I have noticed, that the Action() calls lead to calling the controller constructors. Why is that? Isn't that a performance issue?
Thank you for more information on this!
I have tried setting up a pivot grid following the demos at http://demos.telerik.com/aspnet-mvc/pivotgrid/local-flat-data-binding and http://demos.telerik.com/aspnet-mvc/pivotgrid/remote-flat-data-binding.
using this model
public
class
FundModel
{
public
string
AssetClass {
get
;
set
; }
public
DateTime ReportDate {
get
;
set
; }
public
decimal
? AssetsStart {
get
;
set
; }
}
and this controller
public
ActionResult TestView()
{
return
View(
// GetAdvisors()
GetFunds()
);
}
private
IEnumerable<FundModel> GetFunds()
{
IEnumerable<FundModel> funds;
using
(var context =
new
EPFRUI_Entities())
{
funds = context.vwDailyFundFlowDetails.Take(300).Select(x =>
new
FundModel
{
AssetClass = x.FundName,
ReportDate = x.ReportDate,
AssetsStart = x.AssetsStart
}).ToList();
}
return
funds;
}
​I am passing in my data to this pivot grid based on the demo code
@(Html.Kendo().PivotConfigurator()
.Name(
"configurator"
)
.Height(570)
)
@(Html.Kendo().PivotGrid<FundModel>()
.Name(
"pivotgrid"
)
.Configurator(
"#configurator"
)
.ColumnWidth(120)
.Height(570)
.BindTo(Model)
.DataSource(dataSource => dataSource
.Ajax()
.Schema(schema => schema
.Model(m => m.Field(
"CategoryName"
,
typeof
(
string
)).From(
"Category.CategoryName"
))
.Cube(cube => cube
.Dimensions(dimensions => {
dimensions.Add(model => model.AssetsStart).Caption(
"Assets Start"
);
dimensions.Add(
"CategoryName"
).Caption(
"All Categories"
);
dimensions.Add(model => model.AssetClass).Caption(
"AssetClass"
);
})
.Measures(measures => measures.Add(
"AssetsStart"
).Field(model => model.AssetsStart).AggregateName(
"count"
))
))
.Columns(columns =>
{
columns.Add(
"CategoryName"
).Expand(
true
);
columns.Add(
"AssetClass"
);
})
.Rows(rows => rows.Add(
"AssetClass"
).Expand(
true
))
.Measures(measures => measures.Values(
"Sum"
))
.Events(e => e.Error(
"onError"
))
)
)
Which is getting me a single long line when I run the program and navigate to the view. I have included what shows up in the attached image.
I have also tried setting this up with remote binding and got the same view.
Am I missing an obvious step here? I debugged it and the model has data when the pivot grid is called, and no errors are coming back from the pivotgrid
Hi,
When using the Export to Excel is only works for the current page, is there anyway to export the whole table (dataset)?
Thanks,
Lee.
First off, I am very new to MVC, so apologies in advance.
I don't know what I'm missing, but I have an enum type:
public enum ClientStatus
{
[Description("Unknown")]
Unknown = 0,
[Description("Normal")]
Normal = 1,
[Description("Legal Hold")]
LegalHold = 200
}
There is a database field which holds the integer value corresponding to the enum type. For my grid, I have:
Html.Kendo().Grid<IST.DocstorClient.Database.cache_dsl_client>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(o => o.dsl_client_id).Title("Client ID").EditorTemplateName("#dsl_client_id#");
columns.Bound(o => o.dsl_client_name).Title("Client Name");
columns.Bound(o => o.dsl_client_description).Title("Description");
columns.Bound(o => o.dsl_client_status).Title("Status").ClientTemplate("#=status_name#").EditorTemplateName("ClientStatus");
columns.Command(cmd => cmd.Destroy());
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable()
.Navigatable()
.PersistSelection()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(10)
.Model(model =>
{
model.Id(p => p.dsl_client_id);
model.Field(p => p.dsl_client_id).Editable(false);
})
.Events(events => events.Error("dsr_error_handler"))
.Read("Editing_Read", "Client")
.Create("Editing_Create", "Client")
.Update("Editing_Update", "Client")
.Destroy("Editing_Destroy", "Client")
The item in question here is the column for dsl_client_status, which is defined as a byte? type in the Entity Framework definitions.
I also have a dropdown definition in Shared/EditorTemplates:
@(Html.Kendo().DropDownListFor(m => m)
.Name("ClientStatus")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(EnumHelper.GetSelectList(typeof(IST.DocstorClient.Data.ClientStatus)))
.OptionLabel("Select Status")
.Value(((int)Model).ToString())
)
I have been through a lot of iterations of different things, this is just the state things are in at the moment.
When I click on the cell to edit, I do get the dropdown list, but it is defaulted to the "Select Status", as if there is no value assigned. I can then change the dropdown value, but the database value never gets updated. If I click on it again, the value I changed to shows on the dropdown.
For example:
initial value is "Unknown".
I click to edit, the dropdown list defaults to "Select Status".
I change to "Normal" and click Save Changes. Text still shows as "Unknown".
I click to edit again and the dropdown is defaulted to "Normal"
I've been scouring forums and blogs for days, trying all manner of suggestions, all to no avail. I find it hard to believe that this is that difficult a task to achieve, so I gotta think I'm missing something simple here.
We are trying to make to make our Grid date columns have the verbiage and filter options of "From" and "To". Our hope was that after updating them within the razor syntax we could still use the "AND OR" values. It appears to remove that option after we have to run the ".Operators(operators => operators.ForDate(d => d.Clear()".
Is there something we are doing wrong? When seem to need to run the ".Clear()" to remove other filter options but now we only have one value we can enter. Either being "To" or "From" but not being able to do "To: (n)" [AND | OR] From:". Is this not possible if we are customizing the filters or is there a different route we can take to acomplish this?
-Thanks-
Code Example:
").Filterable(filterable => filterable.Extra(false).Operators(operators => operators.ForDate(d => d.Clear().IsLessThanOrEqualTo("To").IsGreaterThanOrEqualTo("From")))
Hi,
because my dropdown has over 1.000 possible values I've implemented ServersSide filtering
according to this example.
https://demos.telerik.com/aspnet-mvc/dropdownlist/serverfiltering
the only issue is that with a 1000 records servers side filtering still is slow when expanding the dropdownlist. because it the text is empty, all data is retrieved.
To avoid this issue I only select top 100 ".Take(100)" and the performance is way better.
the only issue is, when I open the dropdown for the 2nd time the selected item gets reset to the default one, if the selected item is not in the first 100 records.
In my oppinion, the current selected item should stay.
so My question, is there a way to make the current value stay,
or can I send the current selected value as a parameter?
for the edit Form, I already use the current value, so at least that one is always in the selection
read.Action("FilteredDDL", "some Controller", new { selectedValue = @Model.selectedvalue });
but this only helps if the value is already in the model.
Does someone know a good solution?
Hi, i'm working with Telerik MVC controls (not Kendo controls) as this is an old application and it's been very difficult trying to get any documentation for it as everythings for Kendo now.
I'm trying to get partial views working with this window and using the .refresh() accompanied with the .open() method but i can't get the correct behaviour for this to work.
The URL has been set to one of the methods in the controller and it's not being hit at all and the window is just rendering blank with no items inside it.
Initially this screen was made dynamically using jquery as an iframe - which is why i've updated it to use a static Telerik window (not iframe) and using the .refresh() method but to no avail.
The window looks like the below:
01.
@(Html.Telerik().Window()
02.
.Name("detailWindow")
03.
.Title("Edit Window")
04.
.Modal(true)
05.
.Draggable(true)
06.
.Width(200)
07.
.Height(100)
08.
.Visible(false)
09.
)
And the jquery to perform the refresh looks as follows:
01.
var
abc= $(
"#detailWindow"
).data(
"tWindow"
);
02.
abc.refresh({
03.
url: url, ==>
this
is a valid URL but controller isn't being hit
04.
title:
"wat"
,
05.
data: {
06.
id: 1,
07.
id2: 2
08.
},
09.
});
10.
abc.center().open();
Is there some file that i'm missing or an issue with the above code?
Thanks