Hi support,
I need to create a Parent/Child grid and both grids must be editable. I've seen some examples in the forum and non of them fit my scenario.
In my case both grids uses local data binding so there's no need for .Create() .Read() .Update() .Destroy() methods in the datasource. One action return the view with the data needed to show in both grids.
The problem I'm facing is that when I add .Editable(ed => ed.Mode(GridEditMode.InCell)) to the child grid without specifying a datasource I get this error:
An exception of type 'System.NotSupportedException' occurred in Kendo.Mvc.dll but was not handled in user code
Additional information: There is no DataSource Model Id property specified.
Now if I add a datasource like the one below nothing is shown in the child grid but the header.
01.
.DataSource(dataSource => dataSource
02.
.Ajax()
03.
.ServerOperation(
false
)
04.
.Batch(
true
)
05.
.Model(model =>
06.
{
07.
model.Id(p => p.ID);
08.
})
09.
)
I also checked these demos
http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Editing/edit-master-row-data-in-detail-template
http://www.telerik.com/support/code-library/grid-ajax-hierarchy-editing
but both use a datasource with .Create() .Read() .Update() .Destroy() operations in the child grid so they're useless to me.
Is it possible to create the child grid editable without CRUD operations in its datasource?
Any help will be appreciated.
PS: I don't even need the Read operation in the datasource because I already have these data!
Here's my code
View:
01.
@
using
TelerikTests.Models
02.
@model TestModel
03.
04.
@{
05.
ViewBag.Title =
"Home Page"
;
06.
}
07.
08.
@(Html.Kendo().Grid(Model.Categories)
09.
.Name(
"grid_Parent"
)
10.
.Columns(columns =>
11.
{
12.
columns.Bound(c => c.ID).Hidden();
13.
columns.Bound(c => c.Description)
14.
.Width(50);
15.
columns.Bound(c => c.DateCategory)
16.
.Format(
"{0:yyyy/MM/dd}"
)
17.
.Width(100);
18.
})
19.
.HtmlAttributes(
new
{ style =
"height: 380px;"
})
20.
.Scrollable(x => x.Height(300))
21.
.Sortable(x => x.SortMode(GridSortMode.MultipleColumn))
22.
.Filterable()
23.
.DataSource(dataSource => dataSource
24.
.Ajax()
25.
.ServerOperation(
false
)
26.
.Batch(
true
)
27.
.Model(model =>
28.
{
29.
model.Id(p => p.ID);
30.
})
31.
)
32.
.ClientDetailTemplateId(
"child"
)
33.
.Events(e => e.DetailInit(
"childGridInit"
))
34.
)
35.
36.
<script id=
"child"
type=
"text/kendo-tmpl"
>
37.
@(Html.Kendo().Grid<ProductModel>()
38.
.Name(
"gridChild_#=ID#"
)
39.
.Columns(columns =>
40.
{
41.
columns.Bound(c => c.ID).Hidden();
42.
columns.Bound(c => c.Name)
43.
.Width(70);
44.
columns.Bound(c => c.Price)
45.
.Width(70);
46.
})
47.
//.Editable(x => x.Mode(GridEditMode.InLine))
48.
//.DataSource(dataSource => dataSource
49.
// .Ajax()
50.
// .ServerOperation(false)
51.
// .Batch(true)
52.
// .Model(model =>
53.
// {
54.
// model.Id(p => p.ID);
55.
// })
56.
//)
57.
.ToClientTemplate()
58.
)
59.
</script>
60.
61.
<script>
62.
function childGridInit(e) {
63.
var grid = $(
"#gridChild_"
+ e.data.ID).data(
"kendoGrid"
);
64.
grid.dataSource.data(e.data.Products);
65.
}
66.
</script>
The model:
01.
public
class
TestModel
02.
{
03.
public
IEnumerable<CategoryModel> Categories {
get
;
set
; }
04.
}
05.
06.
public
class
CategoryModel
07.
{
08.
public
Guid ID {
get
;
set
; }
09.
public
string
Description {
get
;
set
; }
10.
public
DateTime DateCategory {
get
;
set
; }
11.
public
IEnumerable<ProductModel> Products {
get
;
set
; }
12.
}
13.
14.
public
class
ProductModel
15.
{
16.
public
Guid ID {
get
;
set
; }
17.
public
DateTime DateProduct {
get
;
set
; }
18.
public
string
Name {
get
;
set
; }
19.
public
decimal
Price {
get
;
set
; }
20.
}
I have a mvc grid with as model { int projectnumber, int Monday }
and code
columns.Bound(c => c.Monday).Title(text: "Monday").ClientFooterTemplate(template: "#=sum#");
.DataSource(datasource => datasource
.Ajax()
.Aggregates(aggregates =>
{
aggregates.Add(a => a.Monday).Sum();
})
Now I only want to create the sum over all lines in the grid with exception of the line with project number 1.
The AJAX read gets back [1,1] and [2,4] and [3,5] So I hope to get a sum of 4+5=9 instead of the 10 I get with a normal sum.
I hope myu question is clear and somebody knows how to do a partial sum.
With kind regards,
Maurice Lucas
Good day,
The spreadsheet control doesn't seem to support nested VLOOKUPS eg
=IFERROR(IFERROR(VLOOKUP(alt_ref&"/"&supplierID&"/"&LEFT(courseCode,4)&"*",Calcs!A:G,6,FALSE),VLOOKUP(alt_ref&"/"&supplierID&"/",Calcs!A:G,6,FALSE)),VLOOKUP(alt_ref&"//",Calcs!A:G,6,FALSE))
This works correctly in Excel.
Regards
Derek
I have an ajax connected grid, and I have a button thats a submit button, when I click it it posts the page and the searchstring I have in a textbox.
This is fine and works, I was just wondering if and how I can with jquery get the button to get ajax to fetch the data for the grid? I would like that to happen without a postback if possible, and it should since its an ajax grid.
any ideas ?
Regards,
Emil
I am binding a ListView to a collection of strings. How can I access that data in the template definition? Model.SearchResults is a type of IEnumberable<string>
@(Html.Kendo().ListView(Model.SearchResults)
.Name("listClients")
.TagName("div")
.ClientTemplateId("clientsTemplate")
.Pageable(pageable => pageable
.PreviousNext(true)
.Info(true)
.PageSizes(true))
.HtmlAttributes(new{style="min-height:300px"})
.DataSource(dataSource => dataSource
.PageSize(1)))
<
script
type
=
"text/x-kendo-tmpl"
id
=
"clientsTemplate"
>
@Html.Action("LoadProfileView", new { clientId = **HOW DO I GET THE VALUE HERE**})
</
script
>
Hi How to draw a fever chart in Kendo bubble chart in ASP.Net MVC . PFA. I would like to draw a background for the buble chart
I got a code for scatter but it is not working for Buble
http://docs.telerik.com/kendo-ui/controls/charts/how-to/draw-on-scatter-plots