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

Event to capture that a new line is added to a GridGroupingControl

Hello,

I'm looking for an event in a GridGroupingControl to inform me about a new row added because it has turned up in the datasource, other than the CurrencyManager's ListChanged event, which doesn't work for me, because record collections in the grid are not committed at that stage and I have incorrect results.

I want then to call SetCurrent on a cell of that row, to make the triangled black arrow appear on it.

Thank you very much for your help.

J.M.


2 Replies

AD Administrator Syncfusion Team November 19, 2007 05:20 PM UTC

Try the SourceListListChangedCompleted event and check for e.ListChangedType = ItemAdded.


//subscribe to the event
this.grid.SourceListListChangedCompleted += new TableListChangedEventHandler(grid_SourceListListChangedCompleted);

//the handler code
void grid_SourceListListChangedCompleted(object sender, TableListChangedEventArgs e)
{
if (e.ListChangedType == ListChangedType.ItemAdded)
{

}
}




AD Administrator Syncfusion Team November 19, 2007 05:36 PM UTC

To actually easily track the new record and set it current, you can use the SourceListRecordChanged event in addition to the SourceListListChangedCompleted event.


Record changedRecord = null;
void gridGroupingControl1_SourceListRecordChanged(object sender, Syncfusion.Grouping.RecordChangedEventArgs e)
{
changedRecord = e.Record;
}

void gridGroupingControl1_SourceListListChangedCompleted(object sender, Syncfusion.Grouping.TableListChangedEventArgs e)
{
if (e.ListChangedType == ListChangedType.ItemAdded && changedRecord != null)
changedRecord.SetCurrent();
}



Loader.
Live Chat Icon For mobile
Up arrow icon