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

Hierarchical Grid Filter value using Combobox

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dharmesh Barochia
Top achievements
Rank 1
Dharmesh Barochia asked on 05 Oct 2009, 09:55 AM

In my application I have given many filters with RadComboBox that works fine.

Today when I first time try to apply filter inside Detail Tables in Hierarchical grid, it display value in Combobox filter template but when I try to filter using Combobox all record disappear in grid. Please let me know if I miss here.

I am not sure but I have doubt that it shold be some special code inside RadScript Block for Hierarchical Detail Tables.

Here is my code

<telerik:GridBoundColumn DataField="ContactPerson" HeaderText="Person"

ReadOnly="True" SortExpression="ContactPerson" UniqueName="ContactPerson" AutoPostBackOnFilter="true"ShowFilterIcon="false" FilterControlWidth="100%" >

<HeaderStyle Width="20%" />

<ItemStyle HorizontalAlign="Left" />

<FilterTemplate>

<telerik:RadComboBox ID="RadComboBoxContactPerson" runat="server"

DataSourceID="linq_ContactPersons" DataTextField="ContactPerson" DataValueField="ContactPerson"

SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ContactPerson").CurrentFilterValue %>'

AppendDataBoundItems="true" OnClientSelectedIndexChanged="ContactPersonChanged">

            <Items>

                  <telerik:RadComboBoxItem Text="Show All" />

            </Items>

      </telerik:RadComboBox>

     

<telerik:RadScriptBlock ID="rsb_Contact" runat="server">

<script type="text/javascript">

                  function ContactPersonChanged(sender, args) {

                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");

tableView.filter("ContactPerson", args.get_item().get_value(), "EqualTo");

}

</script>

</telerik:RadScriptBlock>

</FilterTemplate>

</telerik:GridBoundColumn>

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 05 Oct 2009, 11:11 AM
Hello Dharmesh,

You can try out the following code inorder to filter the detailtable of a grid based on the selection change in the filter radcombobox:
js:
 function ContactPersonChanged(sender, args) 
     {       
        sender.get_parent().filter("ContactPerson", args.get_item().get_value(), "EqualTo"
 
     } 

Thanks
Princy.
Tags
Grid
Asked by
Dharmesh Barochia
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or