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

Refresh remote data?

Thread ID:

Created:

Updated:

Platform:

Replies:

143496 Mar 22,2019 04:41 PM UTC Mar 27,2019 11:58 AM UTC Angular - EJ 2 6
loading
Tags: DropDownList
Timothy Gardini
Asked On March 22, 2019 04:42 PM UTC

Not using data manager how do you tell the Drop Down List control that the data has changed? I'm seeing that data change if I hold the list open, but when it closes and reopens the old data is there.



Thanks.

Prince Oliver [Syncfusion]
Replied On March 25, 2019 07:04 AM UTC

Hi Timothy, 

Greetings from Syncfusion support. 

Based on your scenario, we can invoke the dataBind method in the control to immediately apply the pending property change (i.e.) dataSource change. You need to call the dataBind method after assigning the data to dataSource property. The method is accessible through the control’s instance. 

// assign the dataSource here 
this.dropdownObj.dataBind(); // where this.dropdownObj refers to control's instance 

For further reference, refer the following API reference 

Let us know if you have any further queries. 

Regards, 
Prince 


Timothy Gardini
Replied On March 25, 2019 02:00 PM UTC

This only seems to work if my control isn't using a template.

I'm using the:

 <ng-template #headerTemplate>
<ng-template #itemTemplate let-resources>

option, and that data doesn't seem to be rebinding.

Prince Oliver [Syncfusion]
Replied On March 26, 2019 12:45 PM UTC

Hi Timothy, 

Good day to you. 

We have checked your requirement for refresh the remote dataSource without datamanager, when using a template. Unfortunately, we were unable to replicate the reported issue in our end. We have ensured it with a test sample. Please find the below details for further reference. 


[Component.html] 
<ejs-dropdownlist #employees id='employees' [dataSource]='data' [fields]='fields' [popupHeight]='height' 
  [placeholder]='watermark'> 
  <ng-template #itemTemplate let-data> 
    <div> 
      <div class="ename"> {{data.FirstName}} </div> 
      <div class="job"> {{data.Designation}} </div> 
    </div> 
  </ng-template> 
  <ng-template #valueTemplate let-data> 
    <div> 
      <div class="name"> {{data.FirstName}} </div> 
    </div> 
  </ng-template> 
</ejs-dropdownlist> 


[Component.ts] 
ngAfterViewInit(){ 
    var proxy = this.dropdownlist; 
    document.getElementById('btn').addEventListener('click', function () { 
        const Http = new XMLHttpRequest(); 
        const url = 'https://ej2services.syncfusion.com/production/web-services/api/Employees'; 
        Http.open("Get", url); 
        //Http.setRequestHeader('Content-Type', 'application/json'); 
        Http.send(); 
        Http.onreadystatechange = function (args) { 
            if (Http.readyState == 4 && Http.status == 200) { 
                var data = JSON.parse(Http.response); 
                proxy.dataSource = null; 
                proxy.dataSource = data; 
                proxy.dataBind(); 
            } 
        } 
    }); 
} 

We suspect that there might be a mismatch in data interpolation with the refreshed data in your application. If you bind new data with a different field, then use ng-if condition and change the interpolation data from ng-template(<ng-template #itemTemplate let-data>) element. Also try upgrading to the latest version to ensure this issue.  

If the issue persists, then please share sufficient information to replicate the issue in our end. or else kindly modify the above test sample to replicate the issue and revert it to us. This will help us provide a prompt solution. 

Thanks, 
Prince 


Timothy Gardini
Replied On March 26, 2019 01:07 PM UTC

The example you are showing still has issues. When the data is refreshed and selected it is not appearing in the select list of the drop down.

Timothy Gardini
Replied On March 26, 2019 06:56 PM UTC

I spent more of my time trying to isolate the bug for you. When you set the input, "allowFiltering", to true it breaks. The dropdown list will either not refresh, or show blank items.

Prince Oliver [Syncfusion]
Replied On March 27, 2019 11:58 AM UTC

Hi Timothy, 

We deeply regret for the inconvenience caused. We thank you for taking your valuable time in effort in reporting this bug to us. We have considered this as a defect in our end. The fix for the issue will be included in our upcoming Volume 1 SP1 release scheduled on the month of April 2019.  You can now track the current status of the report, review the proposed resolution timeline, and contact us for any further inquiries through this link: https://www.syncfusion.com/feedback/4979/ 

Regards, 
Prince 


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

;