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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Re-rendering column in grid after data has been updated

Thread ID:

Created:

Updated:

Platform:

Replies:

144366 May 2,2019 04:47 PM UTC May 7,2019 12:36 PM UTC Vue 3
loading
Tags: Data Grid
Emily Nobles
Asked On May 2, 2019 04:47 PM UTC

I am trying to use a DropDownList to filter a column. The current example in the documentation is not working for me:https://ej2.syncfusion.com/vue/documentation/grid/filtering/?no-cache=1#filter-bar-template-with-custom-component
How can I re-render a column in a grid after the data has been updated?

Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 3, 2019 11:14 AM UTC

Hi Emily, 
 
Greetings from Syncfusion. 
 
Query: I am trying to use a DropDownList to filter a column. The current example in the documentation is not working for me:https://ej2.syncfusion.com/vue/documentation/grid/filtering/?no-cache=1#filter-bar-template-with-custom-component How can I re-render a column in a grid after the data has been updated? 
 
Here, we have created a sample with filterBarTemplate with custom component.  Please find the below code example and sample for your reference. 
 
[code example] 
. . . 
new Vue({   
               el: '#app', 
               template: ` 
    <div id="app"> 
        <ejs-grid id="Grid" ref="grid"  :dataSource="data" :created=created :allowFiltering='true'> 
            <e-columns> 
                <e-column field='OrderID' :allowFiltering='false' headerText='Order ID' textAlign='Right' width=100></e-column> 
                <e-column field='CustomerID' headerText='Employee ID' :template='cTemplate' :filterBarTemplate='templateOptions' width=120></e-column> 
                <e-column field='ShipCity' headerText='Ship City' width=100></e-column> 
            </e-columns> 
        </ejs-grid>  
    </div> 
`, 
 
  data() { 
    return { 
      ... 
 
      templateOptions: { 
            create: function (args) { 
                elem = document.createElement('input'); 
                return elem; 
            },  
            write: function (args) { 
              dObj = new DropDownList({ 
                dataSource: data, 
                fields: { text: "CustomerID" }, 
                change: function (args) { 
                  var selVal = args.value; 
                  var grid = document.getElementById('Grid').ej2_instances[0]; 
                  grid.filterByColumn("CustomerID", "equal", selVal); 
                } 
     
              }); 
              dObj.appendTo(elem); 
            }, 
        } 
    }; 
  }, 
  ... 
}); 
 
Please get back to us if you need further assistance. 
 
Regards, 
Thavasianand S. 


Emily Nobles
Replied On May 6, 2019 01:59 PM UTC

Thank you for responding to my question. In our page, we are actually loading the data from an ajax call. When the ajax call completes we update the data on the grid.

Attachment: Code_7fd52e19.zip

Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 7, 2019 12:36 PM UTC

Hi Emily, 

We have also modified our sample by using EJ2-DataManager to provide the data source to the Grid and DropDownList. But we have not faced any issues after the modification. So we have attached the modified sample in the below link for your reference, 


Also, we need some clarification in your requirement. So please share the following details to us. This will help us to provide the solution as early as possible. 

  1. In your first update you have asked this query “How can I re-render a column in a grid after the data has been updated?”. So please share the details about when you want to re-render the Grid columns (i.e after update the Grid data source or after update the dropdownlist data source)?
  2. If your requirement is only re-render the column, then we suggest to use refreshColumns method of the Grid to achieve this requirement. Please ensure whether your issue getting resolved or not after using the refreshColumns method.
  3. Please share your exact issue what you have faced in your project.


Regards, 
Thavasianand S. 


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.

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

Live Chat Icon For mobile
Live Chat Icon