Dear,
I have used datatable as itemsource in sfdatagrid. Now I want to filter records based on the search bar text entered but the filtering should consider all columns with like matching pattern for string as well as numeric columns. Please help me to reset filter also.
Source code for binding Itemsource to dataGrid
dataGrid.AutoGenerateColumns = true;
DataTable dt = new DataTable();
dt = JsonConvert.DeserializeObject<DataTable>(jsonResp["data"].ToString().Trim());
dataGrid.CanUseViewFilter = true;
DV = new DataView(dt);
dataGrid.ItemsSource = DV;
Code of TextChanged event of Searchvbar
private void Search_TextChanged(object sender, TextChangedEventArgs e)
{
if (e.NewTextValue == null)
{
DV.RowFilter = null;
}
else
{
//this.viewModel.FilterText = e.NewTextValue;
DV.RowFilter = "Unit = '" + e.NewTextValue + "'";
}
}
here Unit is my dataGrid Column Name.
Thanking you.