We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Find grid empty or not

Thread ID:





130246 May 2,2017 10:10 AM UTC May 3,2017 09:48 AM UTC ASP.NET Web Forms 1
Tags: Grid
Asked On May 2, 2017 10:10 AM UTC


Jquery how to find grid empty or not ?

        var Productgrid = $('#GridProduct').ejGrid("instance");
        var Productobject = JSON.stringify(grid.model.dataSource);

if ( Productobject == "" || Productobject == null)



Venkatesh Ayothi Raman [Syncfusion]
Replied On May 3, 2017 09:48 AM UTC

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; 
        //do stuff 
If we misunderstood your query, then could you please provide more details about your requirement? 
Venkatesh Ayothiraman. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon