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

To Clear the Datasource for Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

110871 Aug 28,2013 01:01 PM UTC Jun 12,2017 12:13 PM UTC JavaScript 9
loading
Tags: ejGrid
Ram Sagar Mourya
Asked On August 28, 2013 01:01 PM UTC

we are using the javascript api for binding data to Grid and Chart by consuming data from WCF service, everything works fine , but we added the search options using the DataPicker so here data is fetched properly , but old data in the grid is not cleared . we want to clear the data and bind the fresh data.
In chart we have search option based upon date, the data is being appended to existing data. so the chart is getting disturbed.

how to clear the datasource for Grid and how to clear the Chart.

We tried doing
      $('#Container').ejGrid();  ---> without parameters
      $('#Container').ejChart(); ---> without parameters
is it storing the old data in cache or cookies ?



Ram Sagar Mourya
Replied On August 30, 2013 08:19 AM UTC

Is there anybody from syncfusion ?

Yogeshwaran [Syncfusion]
Replied On September 2, 2013 07:18 AM UTC

 Hi Ram Sagar Mourya,

 

Thanks for using Syncfusion products.please find the response for your query.

 

how to clear the datasource for Grid

To clear dataSource in grid . please use below code :

 

$("#Grid").ejGrid("option", { dataSource: [] });

 

For your convenience, we have created below sample sample to clear dataSource of grid.

 

Sample:

ejGrid.zip

 

 

Please let us know if you have any concerns.

 

Regards,

Yogesh R


Gowrimathi S [Syncfusion]
Replied On September 3, 2013 08:16 AM UTC

Hi Ram Sagar Mourya ,

Thanks for using syncfusion product. please find the response.

To clear the chart, use the below code

$("#chart").ejChart("option":{datasource:[]});

We have prepared the sample based on the query. please find the sample in the attachment

Regards

Gowrimathi S



ejChart_6163d6bc.zip

Ram Sagar Mourya
Replied On September 3, 2013 08:45 AM UTC

Hi Yogeshwaran ,

thanks for the reply, we modified the code ,
we are facing two issues :
1.The grid is being cleared when allowinPaging is set to true, data fetched for first few pages of the grid show correct data, but when we click on say page no 10 old data is still available in the grid. we also checked whether the data is wrong or what so, but data is correct. there is some issue with filtered data(search with dates) being bind to the grid.

2.It is not working when allowinPaging is set to false, i mean grid is not being cleared. we are attaching screen showing the firebug error.

may there is need to clear the gridPager also.

plz let us know.

Thanks
Ram Sagar Mourya



syncfusion_grid_8bb7e1b2.zip

Yogeshwaran [Syncfusion]
Replied On September 11, 2013 09:23 AM UTC

 

 Hi Ram Sagar Mourya,

 

Please find the response.

 

Filtered data is bound to grid after dataSource is cleared.

We have provided workaround to avoid the issue “Filtering collection is not cleared after binding new dataSource to grid”. Please find the workaround for this issue.

[code]

$("#clearData").click(function () {

  $("#Grid").ejGrid("option", { dataSource: [] });

  var instance = $("#Grid").ejGrid("instance");

  instance._filterCollection = [];

});

 

Sample:

ejGrid.zip

 

Also we have considered, this as issue . The fix for this issue will available on our upcoming release .

 

Issue with grid pager while clearing and updating dataSource

Thanks for your information, we can reproduce issue with provided data.  The fix for issue “getGridPager is null“ will be available on our upcoming release.

 

Please let us know if you have any further assistance .

 

Regards,

Yogesh R


Márcio Chaves
Replied On November 17, 2014 05:10 PM UTC

 Hi Ram Sagar Mourya,

 

Thanks for using Syncfusion products.please find the response for your query.

 

how to clear the datasource for Grid

To clear dataSource in grid . please use below code :

 

$("#Grid").ejGrid("option", { dataSource: [] });

 

For your convenience, we have created below sample sample to clear dataSource of grid.

 

Sample:

ejGrid.zip

 

 

Please let us know if you have any concerns.

 

Regards,

Yogesh R


Can I use this same method to clear a TreeGrid? I tried but isn't woking well.

Saravanan Arunachalam [Syncfusion]
Replied On April 21, 2017 06:08 AM UTC

Hi Ram Sagar Mourya, 
In TreeGrid, we can empty/add new data source dynamically by using below code snippet.  
function updateDataSource(){  
        $("#TreeGridContainer").ejTreeGrid("option","dataSource",[]);  
      }  
We have prepared a sample and empty the datasource on button click action, please find the sample link below,  
Please let us know if you require further assistance on this.  
Regards,  
Saravanan A. 


Wojciech Boczarski
Replied On June 9, 2017 02:05 PM UTC

Hi

How can I clear data if im using ejChart? Seems to have the same problem. 

Thank you

Saravanan Arunachalam [Syncfusion]
Replied On June 12, 2017 12:13 PM UTC

Hi Ram Sagar,  
Sorry for the inconvenience.   
We have analyzed your query.  As of now we are having an issue in updating the chart with empty data source, so we have logged issue report on “Empty data source is assigned to the series on events, chart is not updated” and fix for the reported issue will be included in our Essential Studio 2017 Volume 2 SP 2 release, which is expected to be out at the end of June 2017. 
Saravanan A. 


CONFIRMATION

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.

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

;