I have the following view which uses the igGrid control.
I would like to know what I need to do to obtain the value of the hidden column, named Id, on selection of the row in my javascript function.
Any assistance in this matter would be greatly appreciated.
@using Infragistics.Web.Mvc@model SA.SysFin.Web.ViewModels.Client.vmClientBankAccounts
<!-- Infragistics Specific Jcript and CSS bundles-->@Scripts.Render("~/bundles/infragisticsjs")@Styles.Render("~/bundles/infragisticscss")
<script src="~/Infragistics/js/infragistics.loader.js"></script>@(Html.Infragistics().Loader() .ScriptPath(Url.Content("~/Infragistics/js/")) .CssPath(Url.Content("~/Infragistics/css/")) .Resources("igGrid") .Render() )
<div class="panel-body"> <div> @(Html.Infragistics().Grid(Model.Rows.AsQueryable()) .ID("vmClientBankAccounts") .Width("100%") .Caption("Bank Account List") .PrimaryKey("AccountNo") .AutoGenerateColumns(false) .RowTemplate("<td>${Id}</td><td><a class='accountKey'>${AccountNo}</a></td><td>${Name}</td><td>${AccountType}</td><td>${BranchName}</td><td>${BranchIBT}</td>")
.Columns(columns => { columns.For(x => x.Id).DataType("string").Hidden(true); columns.For(x => x.AccountNo).DataType("int").Width("140px"); columns.For(x => x.Name).DataType("string"); columns.For(x => x.AccountType).DataType("string").Width("140px"); columns.For(x => x.BranchName).DataType("string").Width("280px"); columns.For(x => x.BranchIBT).DataType("string").Width("110px"); }) .Features(features => { features.Selection().Mode(SelectionMode.Row).MultipleSelection(false); }) .DataBind() .Render() ) </div></div>
<script type="text/javascript">
$(document).ready(function () {
$('#vmClientBankAccounts td .accountKey').click(function (e) { $.ajax({ type: 'GET', url: '/Client/ClientBankAccount', data: { bankAccountId: $('input#Id').val(), bankAccountNo: $(e.target).text() }, success: function (result) { $('#clientContainer').html(result); } }); });
});
</script>
Hello Mark,
You could use something similar to function selectedRowsCellsValue() { var rowId; var rows = $("#grid1").igGridSelection("selectedRows"); $.each(rows, function (ix, el) { rowId = el.element.attr("data-id"); var cellValue = $("#grid1").igGrid("getCellValue", rowId, "Name"); console.log(cellValue); }); }
I have set ProductID column to hidden. You could refer to the attached codeSample for details.
Some useful references at:http://ko.infragistics.com/community/forums/p/78827/398190.aspx
http://help.infragistics.com/Help/Doc/jQuery/2014.1/CLR4.0/html/igGrid_Configure_Column_Hiding.html#column_configuration_overview
http://ko.infragistics.com/community/forums/t/69186.aspxhttp://ko.infragistics.com/community/forums/t/68397.aspx
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.