The error message appears when opening the custom option from the filter icon in RadGridView.
The error message should not appear as there is a text in the textbox. When the enter key is pressed, the textbox value is still not committed which leads to this error. As a workaround, we can create a custom CompositeDataFilterForm override the ProcessCmdKey where we can handle this case.
public class MyCompositeDataFilterForm : CompositeDataFilterForm
{
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if(keyData == Keys.Enter)
{
this.Controls[2] as RadButton).Focus();
(this.Controls[2] as RadButton).PerformClick();
}
return base.ProcessCmdKey(ref msg, keyData);
}
}
private void RadGridView1_CreateCompositeFilterDialog(object sender, GridViewCreateCompositeFilterDialogEventArgs e)
{
var newForm = new MyCompositeDataFilterForm();
e.Dialog = newForm;
}
To reproduce: I want to add multiple items to a filter expression using the Is in list operator. It seems it is space delimited. For example, I want to filter for 'In Progress' and 'Late'. However, when I apply the filter it creates this 'In', 'Progress', and 'Late'. Workaround: Currently, the possible solution that I can suggest is to use underscores to separate the words , e.g. "In_Progress".
When setting the DataFilter.Expression property to an expression that contains negative values, the DataFilter ignores that condition.
Please refer to the attached sample project.
Workaround:One should be able to set the display text of each field (like header text in RadGridView). Very rarely does the displayed column header match the field name exactly. Workaround: https://www.telerik.com/forums/property-display-name#nZuLg2ytd0CXhz-4Q-6urQ
Both editors have the same type - TreeViewDropDownListEditor and there is no way to tell for which one the event is fired.
After selecting the field, the operator editor should be activated, and then the value editor, or the user should be able to do that with the tab key.
To reproduce: set the DataSource property and enable the sorting for the fields drop-down items: Me.RadDataFilter1.SortOrder = SortOrder.Descending Me.RadDataFilter1.SortFieldNames = True When you activate the drop-down editor to select a field name, you will notice that the items are always sorted ascending no matter the SortOrder. Note: RadDataFilter should allow you to sort the drop-down items in descending order. Workaround: Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load AddHandler Me.RadDataFilter1.EditorInitialized, AddressOf EditorInitialized End Sub Private Sub EditorInitialized(sender As Object, e As Telerik.WinControls.UI.TreeNodeEditorInitializedEventArgs) Dim editor As TreeViewDropDownListEditor = TryCast(e.Editor, TreeViewDropDownListEditor) If editor IsNot Nothing Then Dim element As BaseDropDownListEditorElement = TryCast(editor.EditorElement, BaseDropDownListEditorElement) element.ListElement.SortStyle = Telerik.WinControls.Enumerations.SortStyle.Descending End If End Sub
Use attached to reproduce. Workaround: class MyDataFilter : RadDataFilter { protected override RadTreeViewElement CreateTreeViewElement() { return new MyDataFilterElement(); } public override string ThemeClassName { get { return typeof(RadDataFilter).FullName; } } } class MyDataFilterElement : RadDataFilterElement { protected override IVirtualizedElementProvider<RadTreeNode> CreateElementProvider() { return new MyProvider(this); } protected override Type ThemeEffectiveType { get { return typeof(RadDataFilterElement); } } } class MyProvider : DataFilterElementProvider { public MyProvider(RadTreeViewElement treeViewElement) : base(treeViewElement) { } public override IVirtualizedElement<RadTreeNode> CreateElement(RadTreeNode data, object context) { try { return base.CreateElement(data, context); } catch { RadMessageBox.Show("Invalid expression"); } return null; } }
Implement the SQL sentence "IN" with the control. In order to filter the registers that have a value into a column defined into a list of values: [column] IN ('value1', 'value2'.'value3')
The API should also provide functionality for setting a default operator to each of the descriptor items.
Add Item that has a DropDownListEditor for the value part. In addition, the value element should display the value from the DisplayMember.
Workaround: public RadForm1() { InitializeComponent(); this.radDataFilter1.NodeFormatting += radDataFilter1_NodeFormatting; this.radDataFilter1.Editing += radDataFilter1_Editing; } private void radDataFilter1_Editing(object sender, TreeNodeEditingEventArgs e) { e.Cancel = e.Editor is DataFilterCheckboxEditor; } private void radDataFilter1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { DataFilterCriteriaElement nodeElement = e.NodeElement as DataFilterCriteriaElement; if (nodeElement != null) { nodeElement.ValueElement.DrawText = true; if (nodeElement.ValueElement.Children.Count == 0) { if (nodeElement.FieldElement.Text == "Discontinued") { RadCheckBoxElement checkBox = new RadCheckBoxElement(); nodeElement.ValueElement.Children.Add(checkBox); checkBox.Alignment = ContentAlignment.MiddleCenter; checkBox.CheckStateChanged += checkBox_CheckStateChanged; checkBox.StretchHorizontally = false; nodeElement.ValueElement.DrawText = false; } } else { RadCheckBoxElement checkBox = nodeElement.ValueElement.FindDescendant<RadCheckBoxElement>(); if (checkBox != null && nodeElement.FieldElement.Text != "Discontinued") { nodeElement.ValueElement.Children.Remove(checkBox); } else { nodeElement.ValueElement.DrawText = false; } } } } private void checkBox_CheckStateChanged(object sender, EventArgs e) { RadCheckBoxElement checkBox = sender as RadCheckBoxElement; DataFilterCriteriaElement criteriElement = checkBox.Parent.FindAncestor<DataFilterCriteriaElement>(); criteriElement.CriteriaNode.Descriptor.Value = checkBox.IsChecked; }
Please refer to the attached screenshot illustrating what filter expressions and groups are added. As a result, an incorrect RadDataFilter.Expression is produced. RadDataFilter either must always contain a valid expression or indicates somehow when the current expression is not valid.