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

Custom FilterBar on GridGroupingControl

I've looked at the example which allows you to remove custom from the filterbar, this happens by just changing how the listbox is filled and parsed.

I want to change the filterbar to be a textbox with autocomplete, instead of the listbox, but the GridTableFilterBarCellModel seems to be locked into using a listbox.

How would I go about doing this?

3 Replies

HA haneefm Syncfusion Team August 3, 2007 03:54 PM UTC

Hi Nquillen,

Here is a forum that discuss with the textbox filter in a GroupingGrid. Please refer this and let me know if this helps.
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=58888

Below is a forum thread that show you "How to add custom control in a filterbar cell?".
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=61169

See KB article that shows you "How do I efficiently customize the child table/group by using a custom engine?".
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=363

Best regards,
Haneef


NQ Nathaniel Quillen August 3, 2007 05:33 PM UTC

Haneef your awesome, that first page does basicly what i want to do but when i fill the text box with a autocomplete it doesnt show up for some reason?

This is the code for how im adding the autocomplete source:

private void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e)
{
//allow edit on filterbar
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTextBoxCellRenderer cr = cc.Renderer as GridTextBoxCellRenderer;
if (cr != null)
{
Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfo style = cr.CurrentStyle as Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfo;

if (style.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.FilterBar && style.CellType == "TextBox")
{
Syncfusion.Windows.Forms.Grid.Grouping.GridTableDescriptor td = e.TableControl.TableDescriptor;
TextBox t = ((TextBox)cr.Control);
t.AutoCompleteMode = AutoCompleteMode.Suggest;
t.AutoCompleteSource = AutoCompleteSource.CustomSource;
if (t != null && t.AutoCompleteCustomSource != null)
{
t.AutoCompleteCustomSource.Clear();
for (int i = 0; i < this.mainGridGroupingControl.TableModel.Table.FilteredRecords.Count; i++)
{
if (((DataRowView)this.mainGridGroupingControl.TableModel.Table.FilteredRecords[i].GetData())[td.ColIndexToField(cc.ColIndex)] != null)
{
String s = ((DataRowView)this.mainGridGroupingControl.TableModel.Table.FilteredRecords[i].GetData())[td.ColIndexToField(cc.ColIndex)].ToString();
if (!t.AutoCompleteCustomSource.Contains(s))
t.AutoCompleteCustomSource.Add(s);
}
}
}

e.TableControl.Table.CurrentElement = null;
return;
}
}

//disable edit on all others
e.Inner.Cancel = true;
}

On another note is there anyway to make the filterbar unselectable, so when i click on the filterbar it go straight to edit and doesnt affect my other selections, btw i have it on multi row selection?


HA haneefm Syncfusion Team August 6, 2007 11:25 PM UTC

Hi Nquillen,

Filter TextBox:
>>>>>>>>>>>>>>>>>>>>>
This behavior can be achieved easily using our GridGroupingControl. This can be achieved by handling just three events. The following sample demonstrates the technique to achieve the TextBox FilterBar in GridGroupingControl.

Sample:http://www.syncfusion.com/Support/user/uploads/GGC_TextBoxFilterBar_54121fe.zip

Is there anyway to make the filterbar unselectable, so when i click on the filterbar it go straight to edit and doesnt affect my other selections, btw i have it on multi row selection?
>>>>>>>>>>>>>>>>>>>>
If you don't want to select the filter bar then try setting the FilterBarCell Clickable property to false in a QueryCellStyleInfo event and let me know if this helps.

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon