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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Node is closing when updating

Thread ID:

Created:

Updated:

Platform:

Replies:

124419 Jun 8,2016 02:16 PM UTC Jun 16,2016 03:04 PM UTC WinForms 5
loading
Tags: GridGroupingControl
Roger Aspelin
Asked On June 8, 2016 02:16 PM UTC

Hi

I have a server application showing a grouped grid. I also has a client application that can update data in the SQL database thru a WCF API. When the client is updating the WCF host send a callback to the server informing that it has to update the grid.

This is working like a charm until I have a grid with one column grouped. After the server updated the datasource for the gridGroupingControl it will close all open nodes in the grid.

Is it possible to update the datasource and only change data in the cells?! Not closing the nodes? If I do it without grouping it works... 

This is how I update the grid.

private void UpdateListOfcompetitors(bool update)
{
    if (update)
    {
        List<ListOfCompetingCompetitor> competingCompetitor = proxy.ListCompetingCompetitors();
        gridGroupingControl2.DataSource = competingCompetitor;
    }
}

Picture before update is called:



picture after update is called:




Adhikesevan Kothandaraman [Syncfusion]
Replied On June 9, 2016 09:09 AM UTC

Hi Rojar, 

Thanks for using Syncfusion products. 
 
If you want to update the grid with the grouped columns and maintain the expand state of the groups, you can use the SourceListListChanged event to set the TableDirty as false.  Please refer to the following code snippet, 
 
Code Snippet: 
this.gridGroupingControl1.SourceListListChanged += new TableListChangedEventHandler(gridGroupingControl1_SourceListListChanged); 
void gridGroupingControl1_SourceListListChanged(object sender, TableListChangedEventArgs e) 
{ 
    //Set the table as dirty 
    e.Table.TableDirty = false; 
} 
 
Sample Link: 
 
Regards, 
Adhi 
 


Roger Aspelin
Replied On June 9, 2016 05:59 PM UTC

Hi Rojar, 

Thanks for using Syncfusion products. 
 
If you want to update the grid with the grouped columns and maintain the expand state of the groups, you can use the SourceListListChanged event to set the TableDirty as false.  Please refer to the following code snippet, 
 
Code Snippet: 
this.gridGroupingControl1.SourceListListChanged += new TableListChangedEventHandler(gridGroupingControl1_SourceListListChanged); 
void gridGroupingControl1_SourceListListChanged(object sender, TableListChangedEventArgs e) 
{ 
    //Set the table as dirty 
    e.Table.TableDirty = false; 
} 
 
Sample Link: 
 
Regards, 
Adhi 
 


Hi

Can´t get it to work. First I don´t use a DataTabel I use a class to hold my data. Is this a problem? As soon as I set my DataSource to the new entity class it closes the group. even if I do as you proposed

Br,
Roger.

Adhikesevan Kothandaraman [Syncfusion]
Replied On June 13, 2016 03:38 AM UTC

Hi Roger, 
 
Thanks for your update. 
 
We have analyzed your query at our end. from the version of 13.1 we have modified the behavior for the Groups not to collapse all the records while modifying the values. We have created a simple sample to update the datasource to modifying the values. Please refer to the following video and sample, 
 
Video: 
 
Sample: 
 
Note: 
Please let us know your essential studio version. It will helpful for use to provide the exact solution. 
 
Regards, 
Adhi 
 


Roger Aspelin
Replied On June 15, 2016 09:38 AM UTC

Hi Rojar, 

Thanks for using Syncfusion products. 
 
If you want to update the grid with the grouped columns and maintain the expand state of the groups, you can use the SourceListListChanged event to set the TableDirty as false.  Please refer to the following code snippet, 
 
Code Snippet: 
this.gridGroupingControl1.SourceListListChanged += new TableListChangedEventHandler(gridGroupingControl1_SourceListListChanged); 
void gridGroupingControl1_SourceListListChanged(object sender, TableListChangedEventArgs e) 
{ 
    //Set the table as dirty 
    e.Table.TableDirty = false; 
} 
 
Sample Link: 
 
Regards, 
Adhi 
 


Hi

Can´t get it to work. First I don´t use a DataTabel I use a class to hold my data. Is this a problem? As soon as I set my DataSource to the new entity class it closes the group. even if I do as you proposed

Br,
Roger.

Hi

My version is 14.1.0.41.

Yes this is working, if I use a DataTabel as the sorce. But I don´t use a DataTabel as the source. If I do it this way instead it wont work.

Create a class;

        class Data
        {
            public string data1 { get; set; }
            public string data2 { get; set; }
        }

Chage the form load

       List<Data> data = new List<Data>();
        private void Form2_Load(object sender, EventArgs e)
        {           
            for (int i = 0; i < 100; ++i)
            {
                Data item = new Data();
                item.data1 = string.Format("row{0} col{1}", i, 0);
                item.data2 = string.Format("row{0} col{1}", i, 1);
                data.Add(item);
            }
            this.gridGroupingControl1.DataSource = data;
        }

As I understand DataTable is the only way to get it to work?

Br,
Roger



Adhikesevan Kothandaraman [Syncfusion]
Replied On June 16, 2016 03:04 PM UTC

Hi Rojar, 
 
Thanks for your update. 
 
We have analyzed your reported scenario at our end. To update the grid without closing the records, you can use the IsExpandedInitialValue to false. It will set the expand state of the groups when the grid categorizes the groups. Please refer to the following code snippet, 
 
Code Snippet: 
//Set the expand state of groups when initializing   
this.gridGroupingControl1.TopLevelGroupOptions.IsExpandedInitialValue = false; 
 
Sample: 
 
Regards, 
Adhi 
 


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.

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

;