Hi Pratheep,
Thanks for contacting Syncfusion support.
We went through your code example that you have shared for us and found that you are trying to check whether data source is bound to Grid or not. If so, your code example is not recommended way to find the data source is empty or not, because, it works only if you are binding local json data to the grid datasource, not for remote data/adaptors used as grid datasource. And you were get the grid object like “$('#GridProduct').ejGrid("instance");” in such case, it may throws the script error when Grid is not rendered at initial time. So, we suggest you to use the following code example to get the grid instance,
Code example:
<external button Click event>
function buttonClick(args) {
var Productgrid = $('#GridProduct').data("ejGrid"); // create a grid instance.
//do stuff
} |
Do you want to check the Grid data source is empty? If so, we suggest you to use the currentViewData object to find the Grid data source is empty or not. It can be used for both local data source and remote data source/adaptors. Please refer to the following code example,
var Productgrid = $('#GridProduct').data("ejGrid"); // create a grid instance.
var Productobject = Productgrid.model.currentViewData.length;
if(Productobject>1)
//do stuff |
If we misunderstood your query, then could you please provide more details about your requirement?
Regards,
Venkatesh Ayothiraman.