The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
How does one extend the filter so that it behaves like an Excel autofilter?
I have tried capturing the FilterBarTextChanged event and using a code example from this forum
GridCurrentCell cc = gridIDDetailsList.CurrentCell;
// if in the filter row
if(cc.RowIndex == 1 && cc.ColIndex > 0)
{
GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
if(cr!=null)
{
DataTable dt = cr.ListBoxPart.DataSource as DataTable;
string colName = dt.Columns[0].ColumnName;
dt = new DataTable("MyFilterTable");
dt.Columns.Add(new DataColumn(colName));
dt.PrimaryKey = new DataColumn[] {dt.Columns[0]};
DataRow dr = dt.NewRow();
dr[0] = "(none)";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "(custom)";
dt.Rows.Add(dr);
for(int i = gridIDDetailsList.TopRowIndex; i <= gridIDDetailsList.GridCellsRange.Bottom; ++i)
{
dr = dt.NewRow();
dr[0] = gridIDDetailsList[i, cc.ColIndex].FormattedText;
if (dt.Rows.Contains(dr[0]) == false)
dt.Rows.Add(dr);
}
cr.ListBoxPart.DataSource = dt;
}
}
However this only updates one column filter (it is faster than using a string builder, which was in one example)
ADAdministrator Syncfusion Team January 26, 2005 08:50 AM UTC
Did you see this thread?
http://64.78.18.34/Support/Forums/message.aspx?MessageID=23781
It suggests using CurrentCellShowingDropDown to adjust each list as it is droped.
CVCharles VerekerJanuary 26, 2005 09:03 AM UTC
Yes. I had seen that. It seemed rather heavy to repopulate the drop down box every time it is shown, regardless of whether the filter text changes.
It would be nice to be able to go
theFilterBar.ReflectGridChanges = true;
CVCharles VerekerJanuary 26, 2005 09:06 AM UTC
Yes. Your suggestion works - but as I have 16342 rows, it is rather slow! Any suggestions?
ADAdministrator Syncfusion Team January 26, 2005 10:38 AM UTC
You could try this.
Only do the dynamic lists if this.dvTest.RowFilter != "". (Here dvTest is from the sample in the other thread.) So, you would use the default lists which are already created (when the filterbar was wired) if there is no filter on the datasource for the grid. You would do this by just skipping the code in CurrentCellShowingDropDown when dvText.RowFIlter == "". Then when this.dvTest.RowFilter was nonempty, build the new lists in CurrentCellShowingDropDown. The thought would be that these lists would be on the filtered table, so that would be much smaller than the original 16000.