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

Radgrid filter option not selectable

2 Answers 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bryian
Top achievements
Rank 1
Bryian asked on 25 Feb 2014, 10:18 PM
Using version 2012.3.1308.40

Anyone know why the RadGrid filter menu option items are not selectable? Let say I have 3 items in the filter
  1. NoFilter
  2. Contains
  3. StartsWith
  4. EndsWith

On page load the NoFilter is selected. If I select Contains, nothing happen, Nofilter is still selected. Any help would be great.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Feb 2014, 04:26 AM
Hi Bryian,

Initially the filter menu selected is NoFilter, when we type a value to search in the FilterTextBox, and select an option to filter, the respective menu option will be selected. Take a look at the below sample code snippet,and if this doesn't help, please provide the screenshot of your issue and your full code snippet.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true">
    <MasterTableView>
      <Columns>        
        <telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" DataType="System.Int64"/>        
        <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" UniqueName="ShipCity" DataType="System.String" />
      </Columns>
   </MasterTableView>
    <ClientSettings>
        <ClientEvents OnFilterMenuShowing="filterMenuShowing" />
    </ClientSettings>
    <FilterMenu OnClientShowing="MenuShowing" />
</telerik:RadGrid>

JS:
<script type="text/javascript">
    var column = null;
    function MenuShowing(sender, args) {
        if (column == null) return;
        var menu = sender; var items = menu.get_items();
        if (column.get_dataType() == "System.String") {
            var i = 0;
            while (i < items.get_count()) {
                if (!(items.getItem(i).get_value() in { 'NoFilter': '', 'Contains': '', 'NotIsEmpty': '', 'IsEmpty': '', 'StartsWith': '', 'EndsWith': '' })) {
                    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++;
            }
        }
        if (column.get_dataType() == "System.Int64") {
            var j = 0; while (j < items.get_count()) {
                if (!(items.getItem(j).get_value() in { 'NoFilter': '', 'GreaterThan': '', 'LessThan': '', 'NotEqualTo': '', 'EqualTo': '' })) {
                    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;
        menu.repaint();
    }
    function filterMenuShowing(sender, eventArgs) {
        column = eventArgs.get_column();
    }
</script>

Thanks,
Princy

0
Bryian
Top achievements
Rank 1
answered on 28 Feb 2014, 04:14 PM
Thanks, that the codes I found on this website. I guess there nothing wrong with the code. Look like the Infragistic grid and Telerik RadGrid are behaving differently.
Tags
Grid
Asked by
Bryian
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Bryian
Top achievements
Rank 1
Share this question
or