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

How to get FilteringItem in client side

1 Answer 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Emily Fong
Top achievements
Rank 1
Emily Fong asked on 28 Apr 2014, 11:10 AM
Hi, I am using 2013 Q3 version.  I have a problem as follows:

In client side, I have defined RadGrid and the corresponding ClientSettings as follows:
<telerik:RadGrid runat="server" ID="OrgGrid" AutoGenerateColumns="False" AllowSorting="True" AllowFilteringByColumn="True"
                         AllowPaging="True" AllowCustomPaging="true" CellSpacing="0" EnableLinqExpressions="false"
                         EnableViewState="true" ShowGroupPanel="True">
            <ClientSettings AllowColumnsReorder="true" AllowDragToGroup="true" ReorderColumnsOnClient="true">
                <Resizing AllowColumnResize="true" AllowRowResize="false" ResizeGridOnColumnResize="true" />
                <ClientEvents OnColumnResized="OnColumnResized" />
            </ClientSettings>
      ....

I would like to know the way to set the textbox width in the FilteringItem in OnColumnResized event.  I tried the following but it doesn't return anything to me in the textbox.
            function OnColumnResized(sender, eventArgs) {
                var _OrgGrid = $find("<%= OrgGrid.ClientID %>");
                var _MasterTableView = _OrgGrid.get_masterTableView();
                var _filterRow = $telerik.$(_OrgGrid.get_element()).find("rgFilterRow");
                var _textbox = $telerik.findElement(_filterRow[0], "OrgCode");
                _textbox.width = eventArgs.get_gridColumn().get_element().offsetWidth - 40;

                return false;
            }  

Thanks.
Emily



1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 30 Apr 2014, 08:58 AM
Hi Emily Fong,

Please try the following code snippet to set the filter textbox width for a column.

JS:
<script type="text/javascript">
    function OnColumnResized(sender, eventArgs) {
        var grid = $find("<%= RadGrid1.ClientID%>")
        var tableView = grid.get_masterTableView();
        tableView.getColumnByUniqueName("ColumnUniqueName").set_filterFunction(0);      
        var filterRow = $telerik.$(grid.get_element()).find(".rgFilterRow");    
        var txtFilter = $telerik.findElement(filterRow[0], "ColumnUniqueName")     
        txtFilter.style['width'] = '300px';      
    }
</script>

Thanks,
Princy
Tags
Grid
Asked by
Emily Fong
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or