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

Node is closing when updating

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:




5 Replies

AK Adhikesevan Kothandaraman Syncfusion Team 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 
 



RA Roger Aspelin replied to Adhikesevan Kothandaraman 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.


AK Adhikesevan Kothandaraman Syncfusion Team 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 
 



RA Roger Aspelin replied to Roger Aspelin 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




AK Adhikesevan Kothandaraman Syncfusion Team 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 
 


Loader.
Up arrow icon