Add custom button to gridview auto filter filter line

how to add the [x] button to clear the automatic filter, so we don’t need to click the “Delete” or “back” button to clear the filter. Illustration like this

img1

for iam code using for repositoryitemcombobox

private void gridView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) { if (gridView1.OptionsView.ShowAutoFilterRow == true) { for (int i = 0; i < gridView1.RowCount; i++) { string code = gridView1.GetDataRow(i)["code"].ToString(); if (!repositoryItemComboBox1.Items.Contains(code)) { repositoryItemComboBox1.Items.Add(code); } } if (e.Column.FieldName == "genre" && view.IsFilterRow(e.RowHandle)) { e.RepositoryItem = repositoryItemComboBox1; } 

FYI: iam using devexpress

+1
source share
2 answers

Is this a devexpress grid view, isn't it? I don’t know if this solution suits your needs, but you can insert the usual button control next to the grid and put the code from the answer on this site , inside the click.

EDIT: Found the answer to your question - unfortunately, it is not possible to add a custom button to the auto filter line

0
source

(From the top of my head, I guess this is for WinForms controls)

You will need two RepositoryItems objects: one without a clear button and one with a button (you can add buttons through the RepositioryItem Buttons property).

You will assign the RepositoryItem object without an additional button in the corresponding column.

Then you need to process the GridView CustomRowCellEditEventHandler. Verify that the e.RowHandle event is equal to GridControl.AutoFilterRow, and if so, assign e.RepositoryItem to RepositoryItem using the clear button.

Then edit the ClearOfficeItem ButtonClicked event of the clear clear button.

0
source

All Articles