I am trying to select one row from a igGrid where MultipleSelection = false. iqGridSelection("selectRows") returns a row length of 0. It returns the correct row length when MultipleSelection = true. I need to know how to return the row data (row index and column values) from the grid for a single selection case.
@using Infragistics.Web.Mvc@model IQueryable<SenarcSystems.VisualDispatch.BusinessObjects.Vendor> @{ Layout = null;}<!DOCTYPE html><html><head> <!-- Ignite UI Required Combined CSS Files --> <link href="~/Content/IgniteUI/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="~/Content/IgniteUI/css/structure/infragistics.css" rel="stylesheet" /> <script src="~/Scripts/jquery-1.11.0.js"></script> <script src="~/Scripts/jquery-ui-1.10.4.js"></script> <script src="~/Scripts/modernizr.min.js"></script> <!-- Ignite UI Required Combined JavaScript Files --> <script src="~/Scripts/IgniteUI/infragistics.core.js"></script> <script src="~/Scripts/IgniteUI/infragistics.lob.js"></script> <script src="~/Scripts/IgniteUI/infragistics.dv.js"></script> <meta name="viewport" content="width=device-width" /> <title>VendorIndex</title></head><body> <div> @(Html.Infragistics() .Grid(Model) .ID("grid") .Width("100%") .Height("500px") .PrimaryKey("ID") .AutoGenerateColumns(false) .AutoGenerateLayouts(true) .RenderCheckboxes(true) .Columns(column => { column.For(x => x.VendName).HeaderText("Vendor Name").Width("30%"); column.For(x => x.VendStreet1).HeaderText("Street1").Width("30%"); column.For(x => x.VendStreet2).HeaderText("Street2").Width("20%"); column.For(x => x.VendPhone).HeaderText("Phone").Width("20%"); }) .Features(features => { features.Sorting().Type(OpType.Remote); features.Paging().Type(OpType.Remote); features.Filtering().Type(OpType.Remote); features.Selection().Mode(SelectionMode.Row).MultipleSelection(false).Activation(false); }) .DataSourceUrl(Url.Action("LoadVendors")) .Render() ) </div> <div> <fieldset id="selectionOptions" class="explorer"> <legend>Selection</legend> <input type="button" id="buttonAddVendor" value="Add" /> <input type="button" id="buttonEditVendor" value="Edit" /> <input type="button" id="buttonDeleteVendor" value="Delete" /> </fieldset> </div> <script type="text/javascript"> $("#buttonAddVendor").igButton({ labelText: $("#buttonAddVendor").val(), click: function (event) { var rows = $("#grid").igGridSelection("selectedRows"); $.each(rows, function (i, val) { alert("Row with index " + val.index + " is selected"); }); } }); </script></body></html>
Thanks,
Larry
Hello,
I'm just following up to see if you need any further assistance with this. If so please let me know.
Hello Larry,
Thank you for contacting us.
About your question, when the multipleSelection is false you will need to use selectedRow, if the multipleSelection is true, then use selectedRows. For more information about this methods please refer to the link below:
https://www.igniteui.com/help/api/2013.2/ui.iggridselection#methods
Looking forward to hearing from you.