I am new to using SyncFusion controls and do not understand why this happens. If I have more than one SfDataGrid on the same form, then changing the filter on one grid also changes the filter on the other grid even though I have not created any code to link them. I want the grids to use the same data source, but not affect each other's filter or sorting. I am using VS2019 and SF 17.2.0.34. To re-create the problem just create a new winform project and add an sfDataGrid to Form1. Set AllowFiltering to True. Copy and paste the grid so that there are now two grids named sfDataGrid1 and sfDataGrid2. Then add the following code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace sfDataGridProblem
{
public partial class Form1 : Form
{
private DataTable dt = new DataTable();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Selected", typeof(bool));
dt.Rows.Add(new object[] { 1, false });
dt.Rows.Add(new object[] { 2, true });
dt.Rows.Add(new object[] { 3, false });
dt.Rows.Add(new object[] { 4, true });
dt.Rows.Add(new object[] { 5, false });
sfDataGrid1.DataSource = dt;
sfDataGrid2.DataSource = dt;
}
}
}