Author Topic: How to check grid has no rows?  (Read 5718 times)

aniket.kulkarni

  • Newbie
  • *
  • Posts: 22
    • View Profile
How to check grid has no rows?
« on: June 06, 2014, 04:43:29 pm »
Hi!

I want to know how do I check if grid is empty or not before accessing the row from the grid?

//here if grid is empty then creates problem
var rowData2 = $gridMain.pqGrid( "getRowData", {rowIndx: 0} );

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How to check grid has no rows?
« Reply #1 on: June 06, 2014, 05:57:58 pm »

aniket.kulkarni

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: How to check grid has no rows?
« Reply #2 on: June 10, 2014, 06:40:04 pm »
Thanks first one worked.

var totalRecords = $grid.pqGrid('option', 'dataModel.data' ).length;

Second is having problem if grid has data then totalRecords are null but for empty it is 0 (zero).