Search code examples
jquerycss-selectorskendo-gridkendo-asp.net-mvc

How to use jQuery to get a certain value from a table?


I have the following html for Kendo.Grid:

enter image description here

I have an aggregate function that built a footer row with the total of all the amounts in the rows: Total: 91

I need to get that text from the grid.

My Grid has a Click button event which triggers javascript DeleteRecord function:

function DeleteRecord(e) {
    e.preventDefault(e);
    var grid = $("#TicketReportPropertyGrid").getKendoGrid();
    var row = $(e.target).closest("tr");
    var dataItem = grid.dataItem(row);
    dataItem.deleted = true;
    row.addClass('disabledGridRow');
    var totalArea = $('#TicketreportPropertyGrid table tfoot .k-footer-template td').eq(2).text();
    console.log(totalArea);
}

and when trying to console.log(totalArea), it does not print anything into the console

How can I use jQuery to do that?


Solution

  • $('#TicketReportPropertyGrid table tfoot .k-footer-template td').eq(2).text();
                                                      // third td ---^
                                                   // get the innerText ---^