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. Image for the cookie policy date
close icon

sfTree does not refresh when items are added

Hello,

i am working on an app, which uses the sfTreeview. I want to add items while running my app. But the Tree does not refresh, though I am adding items. I can see in the debugger that the items are successfully added, but the tree does not show them. I am running on the android plattform.

I started developing with your example from the docs. I modified it and added an button to add new items to your example. It also does not refresh.

What can I do? Is it a bug or a mistake of mine?

Find attached the bounded sftree-example from Syncfusion.

Greetings from germany
Christian Bender

Attachment: TreeViewSample_f43fcf7a.zip

10 Replies

JN Jayaleshwari N Syncfusion Team February 14, 2019 12:23 PM UTC

Hi Christian,  
   
Thanks for using Syncfusion Products.  
  
We have checked the reported query from our end. We would like to let you know that TreeView does not support to add items at run time so far. We have already considered this as feature request for real-time updates to TreeView. This feature is estimated to be available in our 2019 Volume 1 release which is expected to be rolled out at the end of March 2019. We will appreciate your patience until then.  
   
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link       
  
Regards,  
Jayaleshwari N 



CB Christian Bender March 19, 2019 03:18 PM UTC

Hello,

as read in the news, there is real-time update support in the new beta of the sftreeview. But it seems that my example still does not update. Is there something to activate for the real-time support or am I missing something?

Thank you so far,
Christian Bender 


DY Deivaselvan Y Syncfusion Team March 20, 2019 09:55 AM UTC

Hi Christian,  
 
To update the collection changes in UI, it is necessary to define the NoificationSubscriptionMode as CollectionChange. Here, NotificationSubscriptionMode enum has three members which update collection based on following members. They are 
 
* CollectionChange - Updates its tree structure when child items collection gets changed. 
* PropertyChange - Updates its ChildItems when associated collection property gets changed. 
* None - It is a default mode and it doesn't reflect collection/property changes  
 
We have modified the sample which works fine after defining this API, please find the sample from below. We will soon update regarding NotificatioSubscriptionMode in live and let you know once updated. 
 
 
Please let us know whether you need any further assistance. 
 
Regards, 
Deivaselvan 



CB Christian Bender March 21, 2019 08:57 AM UTC

Thank you. This example works like I wanted.

So now I would like to use that in another App I am currently working on. I added the nuGet-packet with version 17.1.0.32-beta of the sfTreeView and added the NotificationSubsriptionMode to CollectionChange like in your sample.When I run my App, I get exception "Field not found: Xamarin.Forms.BindableProperty Syncfusion.XForms.TreeView.SfTreeView.NotificationSu…". 

Am I right that the refreshing is not included in the current online beta of the lib? Or do I miss something?

Edit: sorry, that was a mistake of mine. I did not see that the packet version in the android project was still old. Now it works as expected. Thank you very much



CB Christian Bender March 21, 2019 04:32 PM UTC

Hello again,

after some testing, I would like to make an suggestion. Would it be possible, to add an NotificationSubscriptionMode with listening for CollectionChange AND PropertyChange?

Greetings,
Christian Bender


DY Deivaselvan Y Syncfusion Team March 22, 2019 09:03 AM UTC

Hi Christian, 
 
We are glad that given solution works in your sample. We suspect your requirement is to get notification whenever collection and property gets changed in ViewModel & Model respectively. If yes, you can get notification in respective collectionchanged and property changed event like below. In attached sample, we have changed Collection in button click and changed property in item click, please find the sample for your reference. 
 
 
public class FileManagerViewModel 
{ 
      public ObservableCollection<FileManager> ImageNodeInfo 
      { 
        get { return imageNodeInfo; } 
        set { this.imageNodeInfo = value; } 
      } 
 
     private void GenerateSource() 
      { 
         ImageNodeInfo.CollectionChanged += ImageNodeInfo_CollectionChanged; 
      } 
            private void ImageNodeInfo_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) 
      { 
        App.Current.MainPage.DisplayAlert("Alert","Collection changed","OK"); 
      } 
} 
 
If above is not your requirement then please explain your use case in detail. What do you mean `to add NotificationSubcriptionMode for CollectionChange and PropertyChange`? thereby we can provide you better solution at the earliest. 
 
Regards, 
Deivaselvan 



CB Christian Bender April 1, 2019 07:05 AM UTC

Hello Deivaselvan,

thank you again! Thats exactly what I looked for. I was not aware that it is possible to set both Subscriptionmodes. But it seems that sometimes after a change the UI is not refreshed. Sometimes it happens, that you can not expand a nested group, because the expander is missing. If you fold the upper group and unfold it again, the expander is visible and you see the items of the nested group.

Regards,
Christian 


DB Dinesh Babu Yadav Syncfusion Team April 2, 2019 12:47 PM UTC

Hi Christian, 
 
We have checked the reported query "Cannot expand a nested group, since expander is missing". Unfortunately, we are unable to  reproduce this issue at our end. Could you please revert us with below details, 
- Please share in which platform the issue is replicating. 
- Please share the device configuration details. 
 
Which would be useful for us to analyze the requirement better and provide an appropriate solution for this.  
 
Regards 
Dinesh Babu Yadav 



CB Christian Bender April 8, 2019 05:48 PM UTC

Hello,

I will prepare a sample for next week on monday. 

Regards,
Christian


DB Dinesh Babu Yadav Syncfusion Team April 9, 2019 07:24 AM UTC

Hi Christian, 
 
Thanks for the update. We will wait to hear from you. 
 
Regards, 
Dinesh Babu Yadav 


Loader.
Live Chat Icon For mobile
Up arrow icon