Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
135
igCombo cascade within igHierarchicalGrid?
posted

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())

Parents
No Data
Reply
  • 18204
    Offline posted

    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.

Children