This is a migrated thread and some comments may be shown as answers.

Problem with new version of telerik and radfilters

3 Answers 92 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Paulo
Top achievements
Rank 1
Paulo asked on 12 Sep 2017, 05:24 PM

Greetings,

As per a previous ticket, in a page we're disabling the ability for users to change the expressions in a radfilter, other than the values and the condition type (contains, starts with, etc).

To do that, we're using, as suggested, in the ExpressionItemCreated event the code:

if (e.Item is RadFilterGroupExpressionItem)
                {
                    RadFilterGroupExpressionItem groupItem = e.Item as RadFilterGroupExpressionItem;
                    groupItem.RemoveButton.Visible = (sender as RadFilter) == FilterChoice;
                    groupItem.AddExpressionButton.Visible = (sender as RadFilter) == FilterChoice;
                    groupItem.AddGroupExpressionButton.Visible = (sender as RadFilter) == FilterChoice;
                    groupItem.GroupOperationChooserLink.Enabled = (sender as RadFilter) == FilterChoice;
                }

                if (e.Item is RadFilterSingleExpressionItem)
                {
                    RadFilterSingleExpressionItem singleItem = e.Item as RadFilterSingleExpressionItem;
                    singleItem.FieldNameChooserLink.Enabled = (sender as RadFilter) == FilterChoice;
                    singleItem.RemoveButton.Visible = (sender as RadFilter) == FilterChoice;
                }

This was working perfectly until we've upgraded to the latest version (due to the security warning you sent). Since then, the dropdown to select the field name and to select And/Or are enabled, even though the code suffered no changes.

We really need to disable these options. Please advise. Thank you.

Best Regards,

Nuno Cabrinha

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 14 Sep 2017, 12:45 PM

Hello Nuno,

I am attaching an example of how to disable certain links (menus) in the filter row. Here is the approach:

  1. in the server code, set a custom CSS class on the links you want to disable, so you can discern them later
  2. with JavaScript, cancel the mouse events on those links. Make sure to do that when necessary. My sample does that on full page postbacks, so you may want to remove the Sys.Application.remove_load() call to handle AJAX requests that include the filter.
  3. optionally, style the link with CSS (e.g., add opacity or change the color).

The Enabled property of an asp:Hyperlink does the following:

  • removes its href attribute
  • sets its CssClass to aspNetDisabled

Thus, it should be considered a fluke that this ever worked for a complex control like ours that relies on JavaScript and handling events to operate.

On a side note, would you agree that I move this thread to the public forums in case other people have a  similar question in the future?

Regards,

Marin Bratanov
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.
0
Paulo
Top achievements
Rank 1
answered on 18 Sep 2017, 09:51 AM

Hello Marin,

The solution proposed seems to be working well, but I would like to also hide the little triangle that suggests a dropdown selection. Is this possible?

You can move this to the forums if you think it will be helpful to others.

Regards,

Nuno Cabrinha

0
Marin Bratanov
Telerik team
answered on 19 Sep 2017, 08:44 AM

Hi Nuno,

I have moved this thread to the forums, thank you for your contribution to the community.

As for hiding the arrow - you can do that with CSS by cascading through the custom class. Below is the change and I am also attaching the modified page as runnable reference.

/*lighweight render mode*/
a.rfField.disableMe:before
{
    content: "";
}
 
/*classic render mode*/
a.rfField.disableMe:hover
{
    background-image: none;
}


Regards,

Marin Bratanov
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.
Tags
Filter
Asked by
Paulo
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Paulo
Top achievements
Rank 1
Share this question
or