Łukasz Kuryło
Top achievements
Rank 1
Łukasz Kuryło
asked on 19 Feb 2010, 07:50 AM
Hi all.
I have a column where I have only three possible values. I want to create a filter column with checkboxes, when I can choose one (or more) of them. I have a radgrid populated using webservice+js, so I want to do it in pure js. For filtering other columns I using a dynamic linq. How can I do that?
I have a column where I have only three possible values. I want to create a filter column with checkboxes, when I can choose one (or more) of them. I have a radgrid populated using webservice+js, so I want to do it in pure js. For filtering other columns I using a dynamic linq. How can I do that?
2 Answers, 1 is accepted
0
Łukasz Kuryło
Top achievements
Rank 1
answered on 22 Feb 2010, 12:36 PM
Ok, I have created this radcombobox with checkboxes
But I have a problem, how to bound the selected values to the build-in filtering?
I would like to use
var filterExpressions = masterTable.get_filterExpressions();
filter = filterExpressions.toDynamicLinq();
and get these values in that way.
| <telerik:GridBoundColumn DataField="Producer" |
| HeaderText="Producer" |
| HeaderStyle-Width="120" |
| ReadOnly="True" |
| CurrentFilterFunction="Contains" |
| AutoPostBackOnFilter="true" |
| SortExpression="Producer" |
| UniqueName="Producer"> |
| <FilterTemplate> |
| <telerik:RadComboBox ID="rcbProducerFilter" |
| runat="server" |
| AppendDataBoundItems="true" |
| EnableLoadOnDemand="true" |
| EmptyMessage="All Types" |
| OnClientItemDataBound="MyGrid.RadComboBoxTemplateItemDataBound" |
| HighlightTemplatedItems="true" |
| AllowCustomText="true" |
| Width="95px" |
| > |
| <WebServiceSettings Method="GetProducers" Path="SampleData.asmx" /> |
| </telerik:RadComboBox> |
| <div id="rcbProducerFilterTemplatePanel" class="templateRadComboBox"> |
| <input name="chk1" type="checkbox" onclick="MyGrid.OnChange()"/> |
| </div> |
| </FilterTemplate> |
| </telerik:GridBoundColumn> |
| MyGrid.RadComboBoxTemplateItemDataBound = function(sender, eventArgs) |
| { |
| var item = eventArgs.get_item(); |
| var dataItem = eventArgs.get_dataItem(); |
| dataItem.Index = item.get_index(); |
| var template = new Sys.UI.Template($get("rcbProducerFilterTemplatePanel")); |
| template.instantiateIn(item.get_element(), dataItem); |
| } |
I would like to use
var filterExpressions = masterTable.get_filterExpressions();
filter = filterExpressions.toDynamicLinq();
and get these values in that way.
0
Hello Łukasz,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
If you are binding the grid through a web-service (client-side databinding) you cannot use the build-in filtering as it is server-side based. What you need to do is to intercept the selected-index changed event of the combo or any other event that you need, issue a call to the web service with information on the filtering criteria and rebind the grid.
Our online example on client-side databinding uses the same implementation approach (although it appears to be using the built-in filtering, actually it does not - the OnCommand event is what does the trick):
http://demos.telerik.com/aspnet-ajax/grid/examples/client/databinding/defaultcs.aspx
All the best,Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.