ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: tcf on January 31, 2016, 10:02:50 am

Title: Trying to display number of rows after loading data?
Post by: tcf 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

Title: Re: Trying to display number of rows after loading data?
Post by: tcf 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
Title: Re: Trying to display number of rows after loading data?
Post by: paramvir 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