I have a grid within a tab strip control. Each tab represents a set of information in a specific language.
The name of each grid is dynamically generated based on the language. ex. ProductInfo_EN , ProductInfo_ES, etc etc
Within the grid I have an editor template defined that contains a dropdownlist. I am editing the grid InLine.
I need to obtain the name of the parent grid from within the editor template so that I can then access cells within the grid for parameters in the loading of the dropdownlist.
I am having trouble determining the name of the parent grid (see below). Everything works fine when I hardcode the name ... but of course that will only work for one language. Any ideas?
<script type="text/javascript">
function sendMasterData() {
var rowID = $("[name=GridRowID]").val();
var model = $(event.srcElement).closest("[data-role=grid]").data("kendoGrid").dataSource.get(rowID);
return {
countrycode: model.ProductData.Country,
lang: model.ProductData.Language,
GlobalFieldName: model.ProductData.FieldName,
MDTableName: model.ProductData.MasterDataTableName
};
}
</script>
@model NewGlobalProductCatalogue.Models.ProductInfo
@(Html.Kendo().DropDownListFor(p => p.ProductData.ProductValue)
.Name("ProductData.ProductValue.MasterDataID")
.DataValueField("MasterDataID")
.DataTextField("MasterDataText")
.DataSource(d => d
.Read(r => r.Action("Index", "MasterDataSelection").Data("sendMasterData").Type(HttpVerbs.Post))
)
.Events(e => e.Change("ChangeMasterData"))
.AutoBind(false)
.SelectedIndex(0)
)
It is the clause $(event.srcElement).closest("[data-role=grid]") that is giving me trouble.
If I just go $("#ProductInfo_EN").data("kendoGrid").dataSource.get(rowID); It all works fine ... but of course this is useless for any other grid except the English one.
Any suggestions would be appreciated.
-Sheldon
The name of each grid is dynamically generated based on the language. ex. ProductInfo_EN , ProductInfo_ES, etc etc
Within the grid I have an editor template defined that contains a dropdownlist. I am editing the grid InLine.
I need to obtain the name of the parent grid from within the editor template so that I can then access cells within the grid for parameters in the loading of the dropdownlist.
I am having trouble determining the name of the parent grid (see below). Everything works fine when I hardcode the name ... but of course that will only work for one language. Any ideas?
<script type="text/javascript">
function sendMasterData() {
var rowID = $("[name=GridRowID]").val();
var model = $(event.srcElement).closest("[data-role=grid]").data("kendoGrid").dataSource.get(rowID);
return {
countrycode: model.ProductData.Country,
lang: model.ProductData.Language,
GlobalFieldName: model.ProductData.FieldName,
MDTableName: model.ProductData.MasterDataTableName
};
}
</script>
@model NewGlobalProductCatalogue.Models.ProductInfo
@(Html.Kendo().DropDownListFor(p => p.ProductData.ProductValue)
.Name("ProductData.ProductValue.MasterDataID")
.DataValueField("MasterDataID")
.DataTextField("MasterDataText")
.DataSource(d => d
.Read(r => r.Action("Index", "MasterDataSelection").Data("sendMasterData").Type(HttpVerbs.Post))
)
.Events(e => e.Change("ChangeMasterData"))
.AutoBind(false)
.SelectedIndex(0)
)
It is the clause $(event.srcElement).closest("[data-role=grid]") that is giving me trouble.
If I just go $("#ProductInfo_EN").data("kendoGrid").dataSource.get(rowID); It all works fine ... but of course this is useless for any other grid except the English one.
Any suggestions would be appreciated.
-Sheldon