Hi!
I have two grids (A,B).
When I select an item in grid A, details should be displayed in grid B.
Grid A contains product groups like "furniture". There are around 300 groups display in grid A.
Grid B contains the actual products associted with this group (e.g chair, table, ...). There are 10-50 product in each group.
Im using the change event on grid A to get the selected row and will then reload the datasource for grid B.
Basically it works but I see all propertys of product in grid B. I've specified the columns I'd like to display. (please see attached screenshot).
1. What I'm doing wrong?
2. What is the appropriate way to do this? Note: I can't use "client detail templates" in grid A.
Here is my code:
Grid A:
Grid B:
Event:
KR
Smart Software
I have two grids (A,B).
When I select an item in grid A, details should be displayed in grid B.
Grid A contains product groups like "furniture". There are around 300 groups display in grid A.
Grid B contains the actual products associted with this group (e.g chair, table, ...). There are 10-50 product in each group.
Im using the change event on grid A to get the selected row and will then reload the datasource for grid B.
Basically it works but I see all propertys of product in grid B. I've specified the columns I'd like to display. (please see attached screenshot).
1. What I'm doing wrong?
2. What is the appropriate way to do this? Note: I can't use "client detail templates" in grid A.
Here is my code:
Grid A:
@(Html.Kendo().Grid<
LFG.Model.Domain.ArticleGroup
>(Model.ArticleGroups)
.Name("groupsGrid")
.Columns(columns =>
{
columns.Bound(o => o.ID);
columns.Bound(o => o.GroupKey);
columns.Bound(o => o.Description);
})
.Pageable()
.Sortable()
.Scrollable()
.Selectable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(LFG.Web.Constants.GridPageSize)
.Events(events => events.Error("grid_error_handler"))
.Model(model =>
{
model.Id(p => p.ID);
})
.ServerOperation(false)
)
.Events(e => e.Change("onRowSelect"))
)
@(Html.Kendo().Grid<
LFG.Model.Domain.Article
>()
.Name("articlesGrid")
.Columns(columns =>
{
columns.Bound(o => o.ID);
columns.Bound(o => o.Description);
columns.Bound(o => o.ProductLine);
columns.Bound(o => o.Age);
columns.Bound(o => o.Approval);
columns.Bound(o => o.Stockpile);
columns.Bound(o => o.Ordered);
columns.Bound(o => o.Certificate);
columns.Bound(o => o.ArtNr);
})
.Pageable()
.Sortable()
.Scrollable()
.Selectable()
.DataSource(dataSource => dataSource
.Server()
.PageSize(LFG.Web.Constants.GridPageSize)
.Model(model =>
{
model.Id(p => p.ID);
})
)
)
function onRowSelect(e) {
var row = this.select();
var id = row[0].childNodes[0].textContent;
console.log("RowSelect - ID: " + id);
var grid = $("#articlesGrid");
if (grid) {
grid.kendoGrid({
dataSource: {
type: "json",
transport: {
read: "/Shared/GetArticlesByGroup?id=" + id
}
}
});
grid.data("kendoGrid").dataSource.read();
}
}
KR
Smart Software