If you use ” $(“#YOUR_SUBGRID table tbody tr”).length”, this actually returns two tables since there are two tables created under sub-grid in portal. Use the following code to refer to the first table which actually holds the selected records. $(“#YOUR_SUBGRID table.table.table-striped tbody tr”).length;