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

Cell value with complex properties is not updated after edit until reload the page

Hi,

  Thanks for providing this awesome plugin=)!

  I have memtioned the member of orderdetails and its updated member raised the property change event and return a correct updated value to the binding       model(OrderinfoViewModel). But the cell value is not be updated after edit until reload the page.

  For example : 

  The class "OrderInfo" contains a class "OrderDetails"(for example, serveral simple datatype members) which is defined.

  And column is generated manually ( AutoGenerateColumns="False")

  How to accomplish this scenario:)?

  
   

3 Replies

BS Balasubramani Sundaram Syncfusion Team January 17, 2020 02:00 PM UTC

Hi yin, 
 
Thank you for contacting Syncfusion support.   
 
Based on your provide details we have analysis the issue and we suspect that maybe you have missed to implement the INotifyPropertyChanged on your underline collection. “INotifyPropertyChanged” Which is helps to update the collection and property at runtime. 
 
If you bound the complex property, the changes will not reflect in UI so we must to implement the NotificationObject to respective property to reflect the changes in view. For both implementation we have provided the codes in below code snippet please refer in it.  
 
Please refer the sample, UG and code snippet,  
 
Code snippet [C#] 
 
 
public class OrderInfo : INotifyPropertyChanged 
{ 
    private int? orderID; 
   
    private CustomerInfo customersinfo; 
 
    //Complex Property 
    public event PropertyChangedEventHandler PropertyChanged; 
 
    private void RaisePropertyChanged(String Name) 
    { 
        if (PropertyChanged != null) 
            this.PropertyChanged(this, new PropertyChangedEventArgs(Name)); 
    } 
 
    public int? OrderID 
    { 
        get { return orderID; } 
        set { this.orderID = value; RaisePropertyChanged("OrderID"); } 
    } 
 
    //Complex Property 
    public CustomerInfo CustomersInfo 
    { 
        get { return customersinfo; } 
        set 
        { 
            this.customersinfo = value; 
            RaisePropertyChanged("CustomersInfo"); 
            this.CustomersInfo.PropertyChanged += CustomersInfo_PropertyChanged; 
        } 
    } 
 
    private void CustomersInfo_PropertyChanged(object sender, PropertyChangedEventArgs e) 
    { 
        RaisePropertyChanged("CustomersInfo." + e.PropertyName); 
    } 
 
    public OrderInfo() 
    { 
    } 
} 
 
public class CustomerInfo : NotificationObject 
{ 
    private string firstName; 
 
    public string FirstName 
    { 
        get { return firstName; } 
        set 
        { 
            this.firstName = value; 
            RaisePropertyChanged("FirstName"); 
        } 
    } 
} 
 
 
 
 
 
We hope this helps. Please let us know, if you need any further assistance. 
 
Regards,
Balasubramani Sundaram.
 
 



YS Yin Shun January 17, 2020 04:33 PM UTC

Hi Balasubramani Sundaram,

  Thanks for your demo and clear to me what's the problem is!
  I missed the registration of the PropertyChanged event on the complex mode=D!

  And now I have one more question 

   //Complex Property 
    public CustomerInfo CustomersInfo 
    { 
        get { return customersinfo; } 
        set 
        { 
            this.customersinfo = value;
           RaisePropertyChanged("CustomersInfo");     // What's the point to keep this line?
            this.CustomersInfo.PropertyChanged += CustomersInfo_PropertyChanged;  // This event seems handle it, isn't it?
        } 
    } 

   Thanks again!

Best Regards,
Jason

  


KK Karthikraja Kalaimani Syncfusion Team January 20, 2020 02:22 PM UTC

Hi Yin Shun,

Sorry for the inconvenience caused. 
No need to call RaisePropertyChanged method on ComplexProperty we have called by mistakenly.

Regards,
Karthik Raja


Loader.
Up arrow icon