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

RadGrid Reducing the filter menu options by column

21 Answers 465 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sri Ram
Top achievements
Rank 1
Sri Ram asked on 11 Aug 2011, 04:00 PM
I have a grid with 5 GridBoundColumns (Name, SSN, DOB, Address, etc..). I want different set of filtering menu options for each of these columns. Is there any way to achieve this?

21 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 11 Aug 2011, 05:46 PM
Hello Sri Ram,

You should be able to change the filter menu options per column following the steps from this help topic.

Best regards,
Sebastian
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Sri Ram
Top achievements
Rank 1
answered on 11 Aug 2011, 06:55 PM
I had seen this article before and am aware that the filter menu options can be reduced. But what I'm looking for is different.

Consider I have a RadGrid with 2 GridBoundColumns

Column 1: Name (Data Type: System.String)
Column 2: Address (Data Type: System.String)

For Column 1: I want to show  "Contains", "StartsWith" and "EndsWith" options in the filter menu
For Column 2: I want to show "Contains" and "EndsWith" only and hide all the rest

Can this be achieved?
0
Sebastian
Telerik team
answered on 12 Aug 2011, 08:27 AM
Hello Sri Ram,

Review the javascript solution presented in the first code paragraph of the documentation article I pointed - it illustrates how to intercept the OnFilterMenuShowing client event of the grid and display different items in the filter menu based on the data type of the column.

You should be able to adjust the code to check for the name of the column instead of its data type, if needed.

Regards,
Sebastian
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Sri Ram
Top achievements
Rank 1
answered on 12 Aug 2011, 07:56 PM
Hi Sebastian,

This approach worked. I was able to reduce the filter menu options based on the column's unique name. Thanks a lot for your help.

However, the filter menu item does not get completely highlighted in blue after this change (I have "WebBlue" skin applied for the Grid). Only one third of the text gets highlighted when I hover over a filter menu item.

Attached image shows how this looks. Is there a fix for this?
0
Sri Ram
Top achievements
Rank 1
answered on 16 Aug 2011, 03:19 PM
Still looking for an answer to the issue stated above...
0
Maria Ilieva
Telerik team
answered on 17 Aug 2011, 01:20 PM
Hi Sri Ram,

The presented issue is definitely not expected in this scenario. Could you please let me know if the same issue appear with the other embedded skins of RadGrid. Also please let me know if you have ajaxified the problematic RadGrid control.
For faster resolution of the problem it will be best if you could open a regular support ticket and send us sample runnable application which demonstrates the described styling issue. Thus we will be able to inspect it locally and advise you further.


All the best,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Sri Ram
Top achievements
Rank 1
answered on 17 Aug 2011, 04:26 PM
Hi Maria,

This issue appears with all skins and the RadGrid is not ajaxified. I've provided the sample code below (I'm not sure how to create a support ticket).

P.S. I'm using RadControls for ASP.NET Ajax Q3 2010.

Default.aspx
----------------

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>RadGrid Skin Issue</title>
    </head>
    <body>
        <form id="frmDefault" runat="server">
            <telerik:RadCodeBlock ID="radCodeBlock1" runat="server">
            
                <script language="javascript" type="text/javascript" >


                    var column = null;
                    var columnName = null;


                    function MenuShowing(sender, args) {


                        if (column == null) return;
                        if (columnName == null) return;


                        var menu = sender; var items = menu.get_items();


                        if (columnName == "Date") {


                            var i = 0;


                            while (i < items.get_count()) {


                                if (!(items.getItem(i).get_value() in { 'NoFilter': '', 'Contains': '', 'GreaterThan': '', 'LessThan': '' })) {
                                    var item = items.getItem(i);
                                    if (item != null)
                                        item.set_visible(false);
                                }
                                else {
                                    var item = items.getItem(i);
                                    if (item != null)
                                        item.set_visible(true);
                                } i++;


                            }


                        }
                        else {
                            if (columnName == "Subject") {


                                var j = 0;


                                while (j < items.get_count()) {


                                    if (!(items.getItem(j).get_value() in { 'NoFilter': '', 'Contains': '', 'StartsWith': '', 'EndsWith': '' })) {
                                        var item = items.getItem(j);
                                        if (item != null)
                                            item.set_visible(false);
                                    }
                                    else {
                                        var item = items.getItem(j);
                                        if (item != null)
                                            item.set_visible(true);
                                    } j++;


                                }


                            }


                        }


                        column = null;
                        columnName = null;


                    }


                    function filterMenuShowing(sender, eventArgs) {
                        column = eventArgs.get_column();
                        columnName = eventArgs.get_column().get_uniqueName();
                    }


                </script>


            </telerik:RadCodeBlock>


            <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>


            <div id="MainDiv">
                <telerik:RadGrid ID="grdMyAlerts" runat="server" Height="205px" Width="695px"
                    Skin="WebBlue" AllowFilteringByColumn="True" EnableLinqExpressions="false" AllowMultiRowSelection="false"
                    AutoGenerateColumns="False">
                    <MasterTableView TableLayout="Fixed">
                        <Columns>
                            <telerik:GridClientSelectColumn HeaderText="Select" HeaderStyle-Font-Bold="true" HeaderStyle-Width="10%"></telerik:GridClientSelectColumn>  
                            <telerik:GridBoundColumn HeaderStyle-Font-Bold="true" HeaderText="Date" HeaderStyle-HorizontalAlign="Left" DataField="Date" 
                                UniqueName="Date" HeaderStyle-Width="25%" ShowFilterIcon="true" 
                                ItemStyle-HorizontalAlign="Left"/>                                                         
                            <telerik:GridBoundColumn HeaderStyle-Font-Bold="true" HeaderText="Subject" HeaderStyle-Width="65%" HeaderStyle-HorizontalAlign="Left" DataField="Subject" 
                            UniqueName="Subject" ShowFilterIcon="true" FilterControlWidth="300"
                            ItemStyle-HorizontalAlign="Left"/>                                                         
                        </Columns>
                    </MasterTableView>
                    <ClientSettings>
                        <Selecting AllowRowSelect="true" />
                        <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
                        <ClientEvents OnFilterMenuShowing="filterMenuShowing" />
                    </ClientSettings>
                    <FilterMenu OnClientShown="MenuShowing" />
                </telerik:RadGrid>
            </div>
        </form>
    </body>
</html>

Default.aspx.vb
--------------------
Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim DataSet As New DataSet
            DataSet.ReadXml(System.AppDomain.CurrentDomain.BaseDirectory & "App_Data\MyData.xml")
            With grdMyAlerts
                .DataSource = DataSet
                .DataBind()
            End With
        End If
    End Sub

End Class

MyData.xml
---------------
<?xml version="1.0" encoding="utf-8" ?>
<NewDataSet>
    <MyAlerts>
        <Date>07/06/2011 2:09:16 PM</Date>
        <SUBJECT>TEST 1</SUBJECT>
        <URL></URL>
    </MyAlerts>
    <MyAlerts>
        <Date>07/06/2011 1:05:13 PM</Date>
        <SUBJECT>TEST 2</SUBJECT>
        <URL></URL>
    </MyAlerts>
    <MyAlerts>
        <Date>07/05/2011 10:34:45 AM</Date>
        <SUBJECT>TEST 3</SUBJECT>
        <URL></URL>
    </MyAlerts>
    <MyAlerts>
        <Date>07/04/2011 5:31:28 PM</Date>
        <SUBJECT>TEST 4</SUBJECT>
        <URL></URL>
    </MyAlerts>
    <MyAlerts>
        <Date>07/03/2011 4:38:56 PM</Date>
        <SUBJECT>TEST 5</SUBJECT>
        <URL></URL>
    </MyAlerts>
</NewDataSet>
0
Maria Ilieva
Telerik team
answered on 22 Aug 2011, 01:57 PM
Hello Sri,

I tried to replicate the described issue locally using the provided code but to no avail. Find attached a sample runnable application which works correctly on my side. test it locally and let me know what the difference in your case is.


Greetings,
Maria Ilieva
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Prashant
Top achievements
Rank 1
answered on 14 Sep 2011, 07:18 PM
Hey Maria,

I work with Sriram and this seems to be a browser based issue. It works differently in different browsers.
IE6 is really bad.....The blue of the webblue is completely missing.
IE7 is a little better than IE6.


Please let us know what could be the possible solutions.

Thanks
Prashant
0
Maria Ilieva
Telerik team
answered on 19 Sep 2011, 02:45 PM
Hi Prashant,

Does the project I have provided replicates the problematic behaviour on your site. My local tests shows that the application works correctly in all browsers. Please open a regular support ticket and send us runnable version of your application which demonstrates the presented issue. Thus we will be able to inspect it locally and advise you further.

Kind regards,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
Sri Ram
Top achievements
Rank 1
answered on 19 Sep 2011, 10:24 PM
Hi Maria,

The project that you have provided seems to have the same issue. Except for the first column in the grid all other columns have this issue (Not sure if you looked at all the columns in the grid).

I've attached screen shots of how the grid filter menus look in IE6 and Firefox.

Thanks,
Sri Ram
0
Iana Tsolova
Telerik team
answered on 22 Sep 2011, 03:11 PM
Hello Sri,

Can you please confirm that this behavior is not replicable if you are using the default filter menu, without reducing the items?

Best wishes,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Sri Ram
Top achievements
Rank 1
answered on 22 Sep 2011, 03:32 PM
Yes that's correct. There is no issues with the default filter menu, without reducing the items.
0
Iana Tsolova
Telerik team
answered on 28 Sep 2011, 10:07 AM
Hello,

Try adding the following styles to the page:
<style type="text/css">
.RadMenu .rmGroup .rmItem {
    width: 100% !important;
    display:inline-block;
}
</style>


All the best,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Sri Ram
Top achievements
Rank 1
answered on 28 Sep 2011, 03:14 PM
Hi Iana,

Adding this style to the page/css fixed the issue in firefox but not in IE6 or IE7. Some of our end users are still using IE6 and IE7 and it is important for us to make it work in IE6, IE7 and Firefox. I've attached a screen shot of how the filter menu item looks in IE6 and IE7 after applying this style.

Please suggest some solution that would work in all browsers. 

Thanks,
Sri Ram
0
Ivan Zhekov
Telerik team
answered on 04 Oct 2011, 04:42 AM
Hi Sri Ram,

My name is Ivan and I work as a front end at Telerik. I was attached to this thread to help find a solution to this issue.

I apologize that we have not yet provided a solution. We are working on this and we have some success, though not a complete one.

I would like to ask you to bear with a bit longer, as we want to provide you with a solution, and not the next thread.

In addition, you could ask to be associated with your company account so you can open support tickets, and not forum threads.

Kind regards,
Ivan Zhekov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Sri Ram
Top achievements
Rank 1
answered on 10 Oct 2011, 03:24 PM
Hi Ivan,

Would it be possible for you to provide us with a solution for this issue within the next 2 weeks? We have a deadline to meet.

Thanks,
Sri Ram
0
Bilal
Top achievements
Rank 1
answered on 20 Oct 2011, 11:45 AM
Hi,

I'm also facing the same scenario/problem.
Could you please keep me updated as well?

Thanks,
Bilal Ghalayini
0
Ivan Zhekov
Telerik team
answered on 24 Oct 2011, 10:31 AM
Bilal, Sri,

We have some development on this one -- we have traced the cause for the issue.

It appears that in this particular case there is a bug in the RadMenuItem own set_visible method. In short, a menu item accumulates different display properties as the method "bubbles" trough the prototype chain. However,  on show those properties are not retrieved, hence you get that nasty bug.

I have logged the bug and we'll try to fix it in due time.

Kind regards,
Ivan Zhekov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Sri Ram
Top achievements
Rank 1
answered on 31 Oct 2011, 03:40 PM
Hi Ivan,

Is there a way/css to remove the left bar (column with a vertical separation on the left side that appears before the filter menu text) from the filter menu?

Thanks,
Sri Ram
0
Ivan Zhekov
Telerik team
answered on 07 Nov 2011, 09:59 AM
Hello Sri Ram,

When you say "left bar" do you mean the border or something else? I have looked at all the Telerik supplied skins and none has that bar out of the box. Would it be that I am looking at something else?

If possible could you attach a screenshot, or open a support ticket with the screenshot and / or some sample code so we could try to produce this locally?

All the best,
Ivan Zhekov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Sri Ram
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Sri Ram
Top achievements
Rank 1
Maria Ilieva
Telerik team
Prashant
Top achievements
Rank 1
Iana Tsolova
Telerik team
Ivan Zhekov
Telerik team
Bilal
Top achievements
Rank 1
Share this question
or