Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / Get cell value from selected row

Get cell value from selected row

New Discussion
Mark Dakyns
Mark Dakyns asked on May 29, 2014 9:29 AM

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>

Sign In to post a reply

Replies

  • 0
    Ivaylo Ganchev
    Ivaylo Ganchev answered on May 23, 2014 1:57 PM

    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.

     

    • 0
      [Infragistics] Boris Toromanov
      [Infragistics] Boris Toromanov answered on May 29, 2014 9:13 AM

      Hello Mark,

      I am checking about the progress of this issue. Please let me know If you need any further assistance on this.

      • 0
        Mark Dakyns
        Mark Dakyns answered on May 29, 2014 9:26 AM

        Many Thanks Boris – this has been resolved.

      • 0
        [Infragistics] Boris Toromanov
        [Infragistics] Boris Toromanov answered on May 29, 2014 9:29 AM

        Nice to hear this!

        Please feel free to let us know if you have any questions, concerns or suggestion about or tool sets, we will be happy to assist.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Mark Dakyns
Favorites
0
Replies
4
Created On
May 29, 2014
Last Post
11 years, 9 months ago

Suggested Discussions

Created by

Created on

May 29, 2014 9:29 AM

Last activity on

Feb 23, 2026 5:20 PM