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
150
How do i pass a value from the row being edited to a combo data source call
posted

I have a grid with a combo on it. I want to limit the items in the combo list based on a value in the grid on that row? In the code below what is the proper format for Model.ProductID? If I hard code this value with an integer, everything works perfectly, so I know everything else is working fine.

Thanks,

@(Html.Infragistics()
    .Grid(Model)
    .ID("igGrid")
    .Caption((string)ViewBag.ClientName + " Products")
    .AutoGenerateColumns(false)
    .RenderCheckboxes(true)
    .PrimaryKey("ClientProductID")
    .Columns(column =>
    {
        column.For(x => x.ClientProductID).Hidden(true);
        column.For(x => x.ClientID).Hidden(true);
        column.For(x => x.ProductID).Template("${ProductName}").HeaderText("Product").Width("40%"); ;
        column.For(x => x.ProductVersionID).HeaderText("Version").Template("${ProductVersionName}").Width("20%");
        column.For(x => x.Active).HeaderText("Active").Width("20%");
        column.For(x => x.InstalledVersion).HeaderText("Installed").Width("20%");
    })
    .Features(f =>
    {
       
        f.Sorting().Mode(SortingMode.Single);
        f.Filtering().Mode(FilterMode.Advanced);
        f.Updating()
        .ColumnSettings(cs =>
        {
            cs.ColumnSetting().ColumnKey("ClientProductID").ReadOnly(true);
            cs.ColumnSetting().ColumnKey("ClientID").ReadOnly(true);
            cs.ColumnSetting().ColumnKey("ProductID").ReadOnly(true);
            cs.ColumnSetting().ColumnKey("ProductName").ReadOnly(true);
            cs.ColumnSetting().ColumnKey("ProductVersionID").EditorType(ColumnEditorType.Combo).ComboEditorOptions(co =>
            {
                co.DataSource(Url.Action("GetProductVersions", new { ProductID =  Model.ProductID }))
                .ID("comboVersion")
                .ValueKey("ProductVersionID")
                .TextKey("VersionNumber")
                .Mode(ComboMode.DropDown)
                .EnableClearButton(false)
                .DataBind();
            });
            cs.ColumnSetting().ColumnKey("ProductVersionName").ReadOnly(true);
            cs.ColumnSetting().ColumnKey("Active").EditorType(ColumnEditorType.Checkbox);
            cs.ColumnSetting().ColumnKey("InstalledVersion").ReadOnly(true);
        })
        .EnableAddRow(false)
        .EnableDeleteRow(false)
        .EditMode(GridEditMode.Row);
    })
    .UpdateUrl(Url.Action("UpdateClientProduct"))
    .DataBind()
    .Render())

Parents
No Data
Reply
  • 7535
    Offline posted

    Hello ,

    Thank you for your post. Sorry for the late replay but if still you need some assistance please get the following information:


    When using a combo editor inside an igGrid the combo is defined as an editor provider. Therefore, you can use the following selector to empty, remove, append items to the combo box:


    ui.editor.igCombo("itemByIndex", id)


    In the editCellStarted event, where id is the Index of item within drop-down list. This will return a json object where the "text" key will give you the value you need.
    You can use $(ui.editor).igCombo("value"); for getting the selected combo item value.
    Please note that Grid API calls do not work as expected with DIV elements and this will give  "Cannot call methods on igCombo prior to initialization" error when trying to handle events. If this is the case please make sure that you are initializing the igGrid in a <table> element, not in a <div>.


    You can refer the following thread to get more information and working sample:

    http://es.infragistics.com/community/forums/t/90402.aspx
    http://es.infragistics.com/community/forums/t/86760.aspx

    Please let me know if I may provide you further assistance.

Children
No Data