unable to clear listview

Hi,

I am not able to clear listview, please let me know how i will do that?

Thanks
Farhan

3 Replies

BM Balaji M Syncfusion Team September 4, 2018 06:26 AM UTC

Hi Farhan, 

Thanks for contacting Syncfusion support. 

We can use either of the following two methods to clear/destroy the ListView Control. 

  • Empty the dataSource
    • In this case, the listview instance is available for the element and we can render listview by updating dataSource property again.
  • Destroy the control completely with destroy method.

Refer the below code snippet to empty the dataSource and destroy the widget

<script> 
    // Empty the ListView DataSource 
    document.getElementById('btn').addEventListener('click', function () { 
        let listObj = document.getElementById('list').ej2_instances[0]; 
        listObj.dataSource = []; 
 
    }); 
 
    // Destroy the ListView 
    document.getElementById('element').addEventListener('click', function () { 
        let listObj = document.getElementById('list').ej2_instances[0]; 
        listObj.destroy(); 
    }); 
</script> 

For your convenience we have prepared a sample and attached below. Refer to the below sample link. 


We recommend you to refer the below API and getting started links to know more about ListView Control. 



Please let us know If you need further assistance on this. 

Regards, 
M. Balaji  



FS Farhan Syed September 4, 2018 07:40 PM UTC

Thanks for your quick reply it worked for me, please put all these methods and properties into your documentation so that everyone easily find on your site also i noticed you site is not SEO compliant so google search do not work.

Thanks
Farhan  


KT Karthick T Syncfusion Team September 6, 2018 12:57 PM UTC

Hi Farhan, 

Thanks for your feedback. 

We can search our Syncfusion documentation site using refined Google site syntax search.  

keywords site:website-address 

For example, to search the ListView destroy property, refer to the below link. 


Please let us know if you need further assistance on this. 

Thanks, 
Karthick T

Loader.
Up arrow icon