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
940
Get cell value from selected row
posted

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>

Parents Reply Children