Thanks for sample code, Vasko!
Please ensure that filtering works when cleaning up the filter value by clicking "X".
Hello again Wayne,
The scenario is now implemented live in the Filter Grid columns with MultiColumnComboBox article.
Kind regards,
Vasko
Progress Telerik
Hi Wayne,
Thank you for the suggestion. Below you can find a sample implementation of the scenario:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" DataSourceID="SqlDataSource1" Width="800px" AllowFilteringByColumn="True">
<MasterTableView DataSourceID="SqlDataSource1" AutoGenerateColumns="false" DataKeyNames="CustomerID">
<Columns>
<telerik:GridBoundColumn UniqueName="CustomerID" HeaderText="Customer ID" DataField="CustomerID" />
<telerik:GridBoundColumn UniqueName="ContactName" HeaderText="ContactName" DataField="ContactName">
<FilterTemplate>
<telerik:RadMultiColumnComboBox runat="server" ID="RadMultiColumnComboBox1" DataSourceID="SqlDataSource1"
Filter="contains" FilterFields="ContactName, ContactTitle, CompanyName" Width="400px" Height="300px"
DataTextField="ContactName" DataValueField="CustomerID"
Placeholder="select from the dropdown or type">
<ColumnsCollection>
<telerik:MultiColumnComboBoxColumn Field="ContactName" Title="Name" Width="200px" />
<telerik:MultiColumnComboBoxColumn Field="ContactTitle" Title="Title" Width="200px" />
<telerik:MultiColumnComboBoxColumn Field="CompanyName" Title="Company" Width="200px" />
</ColumnsCollection>
<ClientEvents OnChange="onChange" />
</telerik:RadMultiColumnComboBox>
</FilterTemplate>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="ContactTitle" HeaderText="ContactTitle" DataField="ContactTitle" />
<telerik:GridBoundColumn UniqueName="CompanyName" HeaderText="CompanyName" DataField="CompanyName" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [CustomerID], [ContactName], [ContactTitle], [CompanyName] FROM [Customers]"></asp:SqlDataSource>
function onChange(sender, args) {
var grid = $find("<%=RadGrid1.ClientID %>");
var tableView = grid.get_masterTableView();
var filterText = sender.get_dataItem().ContactName; // You can also specify the other fields, depending on the returned data
tableView.filter("ContactName", filterText, "EqualTo");
}
Additionally, the above implementation will be made into a knowledge-base article.
Kind regards,
Vasko
Progress Telerik