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
55
How to get the selected row of iggrid
posted

Hi,

am using the mvc4 razor control and my requirment is like that I have a panel above the grid and in that i have text boxes and dropdowns and when am going to click on grid row then that respective data need to bind with the panels controls means into the textboxex and dropdown. and my code is like that

 @using Infragistics.Web.Mvc
@{
    ViewBag.Title = "Index";
}
@using Infragistics.Web.Mvc
@using System.Data
@*@model  Infragistics .Web.Mvc .GridModel*@
<!DOCTYPE html>
<html>
<head>
   
    
</head>
<body>
    @(Html.Infragistics().Loader()
        .ScriptPath(Url.Content("~/Infragistics/js/"))
        .CssPath(Url.Content("~/Infragistics/css/"))
        .Resources("igHierarchicalGrid.*")

        .Render()

    )
    @(Html.Infragistics().Grid<System.Data.DataSet>()
                .ID("grid1")
        .Width("100%")
        .AutoGenerateColumns(true)
        .AutoGenerateLayouts(true)

                    .Features(features =>
                    {
                        features.Sorting().Type(OpType.Local).Mode(SortingMode.Single).Inherit(true);
                        features.Paging().PageSize(5).Type(OpType.Remote).Inherit(false);
                        features.Filtering().Type(OpType.Local).Inherit(true);
                        features.Selection().Mode(SelectionMode.Row).MultipleSelection(true);
                        features.GroupBy().Type(OpType.Local).Inherit(true);
                        features.Hiding().Inherit(true);
                    })
        .DataSource(Model)
        .DataSourceUrl(Url.Action("dataset-binding"))
        .DataBind()
        .Render()
    )
</body>
</html>

and also let me know the solution to add the addclient event for gridmodel class.

Parents
  • 20255
    Suggested Answer
    Offline posted

    Hello,

    Thank you for contacting us.

    About your question, you can handle activeRowChanged event which is fired after a row becomes active, and there to set values to input and dropDown for example:

    1. $(document).delegate("#rowSelectionGrid", "iggridselectionactiverowchanged", function (evt, ui) {
    2.                 //return reference to igGridSelection object
    3.                 ui.owner;
    4.                 //return reference to row object
    5.                 ui.row;
    6.  
    7.                 var name = $($(ui.row.element).find("td")[0]).text();
    8.                 $("#input1").val(name);
    9.  
    10.                 var title = $($(ui.row.element).find("td")[1]).text();
    11.                 $("#select1 option[value='" + title + "']").attr("selected", "selected");
    12.             });

    Also I have created sample for you, in order to show you my approach.

    http://jsfiddle.net/24xbm/2/

    Other useful references:

    Using Events in Ignite UI

    IGNITEUI API REFERENCE

    If there is something else that I could help you with, please contact me.

Reply Children