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

Dynamically add row at the top, below the header row

Hi,

  I just wanted to add  an empty row  dynamically at the top of the sfTreegrid, below the header row. This is to filter the sfTreeGrid values. How can I do this?

There is any  other option in sfTreeGrid to display an empty row at top, just like unboud row in sfDataGRid?

Thanks&Regards,
Siju

1 Reply

MK Muthukumar Kalyanasundaram Syncfusion Team July 2, 2017 07:12 AM UTC

Hi Siju, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your query. Please find the response from below table. 
 
 
Query 1: 
 To filter the sfTreeGrid values. How can I do this? 
 
 
If you want to filter the records in SfTreeGrid, you can achieve by setting SfTreeGrid.View.Filter delegate and also you can refresh the view by calling SfTreeGrid.View.RefreshFilter method.  
Could you please refer the below code, 
 
Code Snippet: 
 
private void OnFilterChanged() 
{ 
    var viewModel = this.DataContext as EmployeeRepository; 
    if (treeGrid.View != null) 
    { 
        treeGrid.View.Filter = viewModel.FilerRecords; 
        treeGrid.View.RefreshFilter(); 
    } 
} 
 
 
For more details about filtering in SfTreeGrid, you can refer the below link, 
 
 
Query 2: 
There is any  other option in sfTreeGrid to display an empty row at top, just like unbound row in sfDataGRid? 
 
 
If you want to insert the empty row at top position of SfTreeGrid, you can use the underlying collection to insert the new row.  Could you please refer the below code, 
 
Code Snippet: 
 
private void Button_Click(object sender, RoutedEventArgs e) 
{ 
    view = (this.treeGrid.DataContext as EmployeeRepository).EmployeeDetails; 
    view.Insert(0, new Employee() { }); 
} 
 
 
 
 
Please let us know if you have any query. 
 
Regards, 
Muthukumar K 


Loader.
Live Chat Icon For mobile
Up arrow icon