ComboBox : visibility of arrow button

6 posts, 0 answers
  1. Frédéric
    Frédéric avatar
    3 posts
    Member since:
    Oct 2017

    Posted 03 Oct Link to this post

    Hello,

    I have a grid view with a cell containing either a TextBox which is ReanOnly or a ComboBox for which the user has to select a value.

    The arrow button of ComboBox cell is only visible when user clicks on cell to edit it. Thus, the user does not know if he has to select or not a value

    I'd like that the arrow button of ComboBox cell is always visible to indicate to user that a value has to be selected.

    I've tried to set the visibility of arrow button in EditorRequired event but it has no effect.

            void QualityControlsEntryGridView_EditorRequired(object sender, EditorRequiredEventArgs e)
            {
                if (QualityControlsEntryGridView.Columns["Result"].IsCurrent)
                {
                    if (QualityControlsEntryGridView.CurrentRow.Cells["ReferenceValueToType"].Value.ToString() != "")
                    {
                        e.Editor = new RadTextBoxEditor();
                        e.EditorType = typeof(RadTextBoxEditor);
                    }
                    else
                    {
                        e.Editor = new RadDropDownListEditor();
                        e.EditorType = typeof(RadDropDownListEditor);
                        RadDropDownListEditorElement editorElement = (RadDropDownListEditorElement)((RadDropDownListEditor)e.Editor).EditorElement;
                        editorElement.ArrowButton.Visibility = ElementVisibility.Visible;
                    }
                }
            }

  2. Dess
    Admin
    Dess avatar
    2110 posts

    Posted 04 Oct Link to this post

    Hello, Frédéric,  

    Thank you for writing.  

    Note that the editor is shown only when RadGridView enters edit mode. Only one cell can be in edit mode at a time. However, in order to indicate in the cell that the user has to select a value from a predefined list, you can refer to the following KB article: http://www.telerik.com/support/kb/winforms/details/indicate-the-editor-type-in-radgridview-columns

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Frédéric
    Frédéric avatar
    3 posts
    Member since:
    Oct 2017

    Posted 04 Oct Link to this post

    Hello Dess,

    Thank you for your reply.

    With the IndicatedComboBoxColumn is the arrow button displayed for all cells of the column but in my case, one column can contain a TextBox or a ComboBox and I'd like that arrow button is visible only for cells containing a ComboBox.

  4. Dess
    Admin
    Dess avatar
    2110 posts

    Posted 04 Oct Link to this post

    Hello, Frédéric,   

    Thank you for writing back. 

    In the OnCellFormatting method of the custom GridComboBoxCellElement, the indicator element is shown/hidden considering the EnableIndicator property of the column. Here is the appropriate place to show/hide the indicator according to your custom logic. Note that you have access to the data row by the RowInfo property.

    I hope this information helps. If you have any additional questions, please let me know. 

     Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Frédéric
    Frédéric avatar
    3 posts
    Member since:
    Oct 2017

    Posted 05 Oct Link to this post

    Hello Dess,

    In the OnCellFormatting method, I've tried to retrive the type of editor and thus to set the visibility of the arrow button only if the editor is a RadDropDownListEditor.

    But it does'nt work because ActiveEditor is always null.

     

            protected override void OnCellFormatting(CellFormattingEventArgs e)
            {
                base.OnCellFormatting(e);
                if (indicator != null)
                {
                    bool bRadDropDownListEditor = e.CellElement.GridViewElement.ActiveEditor is RadDropDownListEditor;
                    indicator.Visibility = ((IndicatedComboBoxColumn)this.ColumnInfo).EnableIndicator && bRadDropDownListEditor ? ElementVisibility.Visible : ElementVisibility.Collapsed;
                }
            }

  6. Dess
    Admin
    Dess avatar
    2110 posts

    Posted 05 Oct Link to this post

    Hello, Frédéric,   

    Thank you for writing back. 

    I would try to explain once again how the editing mechanism in RadGridView works. When RadGridView is not in read-only mode users can edit the contents of the current cell. Usually, this process starts by typing in the cell or by pressing F2. However, in a normal state, the grid is not in edit mode. That is why the editor is null on your end. Additional information for the editing process is available in the following section of the documentation: http://docs.telerik.com/devtools/winforms/gridview/editors/editors

    Instead of checking whether the editor is active, you can store any useful information in the Tag property of the RowInfo. Thus, you can use this stored information and determine whether to show or hide the arrow.

    I hope this information helps. If you have any additional questions, please let me know. 

     Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top