hi, i try to create cascade combos but i cant AddClientEvent to ComboEditorOptions here my code
@(Html.Infragistics() .Grid(Model.Pisos) .ID("grdMenu") .LoadOnDemand(false) .AutoGenerateColumns(false) .PrimaryKey("IdPiso") .AutoGenerateLayouts(false) .AutoCommit(true) .Columns(cols => { cols.For(x => x.IdPiso).Width("25%").HeaderText("Level"); cols.For(x => x.DescPiso).Width("25%").HeaderText("Description"); cols.For(x => x.IdTypeComposition).Width("25%").HeaderText("TypeComposition").FormatterFunction("lookupType"); cols.For(x => x.IdFormato).Width("25%").HeaderText("UPCFormat").FormatterFunction("lookupUPC"); //cols.For(x => x.FormatoUPC).Width("25%").HeaderText("UPCFormat"); cols.For(x => x.Bunches).Width("25%").HeaderText("Bunches"); }) .ColumnLayouts(layouts => { layouts.For(x => x.Composition) .PrimaryKey("IdProduct") .ForeignKey("IdPiso") .AutoGenerateColumns(false) .Features(feature => { feature.MultiColumnHeaders(); }) .Columns(childcols1 => { childcols1.MultiColumnHeader().HeaderText("Composition").Group(c => { c.For(x => x.Product).HeaderText("Product"); c.For(x => x.Variety).HeaderText("Variety"); c.For(x => x.Grade).HeaderText("Grade"); c.For(x => x.Stems).HeaderText("Stems"); }); }); layouts.For(x => x.Material) .PrimaryKey("IdMaterial") .ForeignKey("IdPiso") .AutoGenerateColumns(false) .Features(feature => { feature.MultiColumnHeaders(); feature.Updating() .AddRowLabel("New Level") .AddClientEvent("selectionChanged", "EditCell") .ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("Tipo").EditorType(ColumnEditorType.Combo).Required(true).ComboEditorOptions(co => co.ID("grdcbTipo").DataSource("/NewFinalProd/getMaterial").ValueKey("codsub").TextKey("nomsub").Mode(ComboMode.DropDown).EnableClearButton(false).AddClientEvent("selectionChanged", "loadDescription")); settings.ColumnSetting().ColumnKey("Description").EditorType(ColumnEditorType.Combo).Required(true).ComboEditorOptions(co => co.ID("grdcbMaterial").DataSource("/NewFinalProd/getMaterial").ValueKey("codsub").TextKey("nomsub").Mode(ComboMode.DropDown).EnableClearButton(false)); }) .EnableAddRow(true) .EnableDeleteRow(false) .EditMode(GridEditMode.Row) .ShowReadonlyEditors(false); }) .Columns(childcols2 => { childcols2.MultiColumnHeader().HeaderText("Material").Group(c => { c.For(x => x.Tipo).HeaderText("Type"); c.For(x => x.Descripcion).HeaderText("Description"); c.For(x => x.Cantidad).HeaderText("Quantity"); }); });
}) .Features(feature => { feature.MultiColumnHeaders(); feature.Updating() .AddRowLabel("New Level") .AddClientEvent("editRowEnded", "bridgeEditRow") .ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("IdPiso").ReadOnly(true); settings.ColumnSetting().ColumnKey("IdTypeComposition").EditorType(ColumnEditorType.Combo).Required(true).ComboEditorOptions(co => co.DataSource(ViewBag.lstType).ValueKey("IdTypeComposition").TextKey("NameCoposition").Mode(ComboMode.DropDown).EnableClearButton(false)); settings.ColumnSetting().ColumnKey("IdFormato").EditorType(ColumnEditorType.Combo).Required(true).ComboEditorOptions(co => co.DataSource(ViewBag.lstUPC).ValueKey("IDFormato").TextKey("Formato").Mode(ComboMode.DropDown).EnableClearButton(false)); }) .EnableAddRow(true) .EnableDeleteRow(false) .EditMode(GridEditMode.Row) .ShowReadonlyEditors(false); }) .Width("100%") .DataSourceUrl(Url.Action("GetFinalproductPisosByIdFinalProd")) .DataBind().Render())
Hello Jorge,
Thank you for posting in our forums!
Could you elaborate on what you mean when you say you cannot use AddClientEvent? I see it being used in your code and I tried implementing it in a sample and it works using the following code:
cshtml:
.ComboEditorOptions(co =>{ co.ID("grdcbTipo").DataSource(Url.Action("ComboData")).ValueKey("CategoryID").TextKey("CategoryName").Mode(ComboMode.DropDown).EnableClearButton(false).AddClientEvent("selectionChanged", "loadDescription");});
javascript code:
function loadDescription(evt, ui) { console.log("test");}
You can use the selectionChanged event to set up the second combo like described in our documentation.
Looking forward to hearing from you.
hi, thanks for your help,
if i run the visual i get this error:
'Infragistics.Web.Mvc.ColumnUpdatingComboEditorOptionsWrapper' does not contain a definition for 'AddClientEvent' and no extension method 'AddClientEvent' accepting a first argument of type 'Infragistics.Web.Mvc.ColumnUpdatingComboEditorOptionsWrapper' could be found (are you missing a using directive or an assembly reference?)
Hi Jorge,
The formatter function can be set on each column in the column collection like in the igGrid.
Are you asking specifically how you would create the lookup tables for the igHierarhcicalGrid?
There are many options available for this. You could send down a separate JSON object to keep track of the values. I do not know how your data is formatted, so I cannot provide any specific information.
If I am misunderstanding your question, please try to clarify for me.
Hi again,
i need know how create de lookup tables, in the iggrid i use this:
var TypeLookup = [], UPCLookup = [], loadingIndicator; $(function () { var grid = $("#grdMenuE"), comboDataSource = {}; comboDataSource = grid.data("igGridUpdating").options.columnSettings[1].editorOptions.dataSource; for (var i = 0; i < comboDataSource.length; i++) { TypeLookup[comboDataSource[i].IdTypeComposition] = comboDataSource[i]; } comboDataSource = grid.data("igGridUpdating").options.columnSettings[2].editorOptions.dataSource; for (var i = 0; i < comboDataSource.length; i++) { UPCLookup[comboDataSource[i].IDFormato] = comboDataSource[i]; } });
function lookupType(id) { return TypeLookup[id].NameCoposition; }
but i don't know hou access the editors from de igHierarhcicalGrid, the data comes from the database a c# list<t>.
Each child grid is its own instance of an igGrid. You can access them using the allChildrenWidgets method. This would require the children to be populated and rendered first, so you may need to handle the childGridRendered event, which even provides the childgrid object in the arguments.
Other than that, you could also send the lookup data in its own object so you do not need to search through the datasource like that.
If you have any further questions or concerns with this, please let me know.
Hi Michael,
thanks a lot for your help , i will try this options.
Glad I could help. If you need further assistance with this, please let me know.