Author Topic: Trying to display number of rows after loading data?  (Read 2939 times)

tcf

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 13
    • View Profile
Trying to display number of rows after loading data?
« on: January 31, 2016, 10:02:50 am »
If I do the following:

$( "#grid_brands" ).pqGrid(obj_brands);
alert($( "#grid_brands" ).pqGrid('option', 'dataModel.data' ).length);

results in a: "Unable to get property 'length' of undefined or null reference"

but if I do...

$( "#grid_brands" ).pqGrid(obj_brands);
alert("wait");
alert($( "#grid_brands" ).pqGrid('option', 'dataModel.data' ).length);

then it works and the number of rows is displayed.

Is there anyway I can check if the data has been loaded before displaying the number of rows ?

Thanks


tcf

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Trying to display number of rows after loading data?
« Reply #1 on: January 31, 2016, 06:02:44 pm »
I've managed to sort this problem out now by calling:

$( "#grid_brands" ).pqGrid('option', 'dataModel.data' ).length

from the refresh event.

Thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: Trying to display number of rows after loading data?
« Reply #2 on: February 01, 2016, 12:04:21 pm »
If it's remote data, load event is the appropriate event to check number of records.

http://paramquery.com/pro/api#event-load