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

Members Filter Categorizing

8 Answers 34 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
WILLIAM
Top achievements
Rank 1
WILLIAM asked on 07 Aug 2014, 09:15 PM
Based on some of the entries regarding the RadDataFilter; several users have asked for the functionality to be able to Filter or Categorize the list of Members in the drop-down.  If the member's is a list of a several hundred entries, it becomes difficult to find what you're looking for.  Also based on the entries in the forum I don't see any indication that telerik is working to provide this functionality.  I am one of the users that needs this, as the members list is just too long.

I have actually tried to implement my own version by adding a RadComboBox on top of the Filter, and have actually been able get the combo box bound to data.  This idea is to pick a value from the top comboBox and the members comboBox would be filtered to only show the related memebers.  However, during the EditorCreated event, the element that is passed in is a StringFilterEditor.  This has no parent and no visual parent either.  In your basic control you have a stack panel with a comboBox (the members), another comboBox (the operators), and the editor.

I have found no way to find my control, or your controls for that matter, during the EditorCreated event, even though I know my control has been added.  Why is it impossible to find the other controls?  I've even named them, and at some point, the name gets removed.

How do I find the other controls?  See my attachment for what I've been able to accomplish.  I'm 90% there, and could finish this if I could only find the other controls.

:-(

8 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 12 Aug 2014, 11:07 AM
Hi,

Generally you can find all the controls in RadDataFilter by their type.
For example:
//get the list of all RadComboBoxes currently available in RadDataFilter.
var childrenComboBoxes = dataFilter.ChildrenOfType<RadComboBox>();

As you mention the EditorCreated event, please keep in mind this event is going to be fired for each editor to be created. The EditorCreatedEventArgs expose two members: Editor and ItemPropertyDefinition. The sender is the RadDataFilter. You can also refer to its online documentation.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
WILLIAM
Top achievements
Rank 1
answered on 12 Aug 2014, 12:47 PM
I did try that approach and was not able to the controls, but I will give it another try.

Thanks!!
0
WILLIAM
Top achievements
Rank 1
answered on 12 Aug 2014, 07:39 PM
I did try your suggested method again, but I'm still seeing the same results, which is my new combo box hasn't been added.

The code snippet below is called during the EditorCreated event.  I get the StackPanel of the FilterMember combo box, create a new RadComboBox and Insert it in the StackPanel at position 0.  What I expect to see in the UI, is a StackPanel (orientation horizontal) which contains the new comboBox I created that is blank, the member filter combo box, the operator combo box, and the filter editor.

Based on my code snippet, is what I've stated above correct, because I only see the regular telerik panel.

When I place a break point at the end of my code snippet, I see that stack panel has an additional control, which leads me to believe I've added it correctly.  However it doesn't show up; and with each additional filter that is added, the count increases by 1 (not a total of 6 controls in the panel), but 6 controls, then 7 controls, then 8 controls; etc.

???

Thanks!!!!

private void EditorSetupCustomRecord(RadDataFilter dataFilter)
{
    if (dataFilter == null) return;
 
    var telerikMemberCombo = dataFilter
                .ChildrenOfType<RadComboBox>()
                .FirstOrDefault(rcb => rcb.Name == "PART_SimpleFilterMemberComboBox");
    if (telerikMemberCombo == null) return;
  
    var memberComboParent = telerikMemberCombo.Parent as StackPanel;
    if (memberComboParent == null) return;
  
    var rcbCustomRecords = new RadComboBox()
                               {
                                   Margin = new Thickness(0, 0, 8, 1),
                                   HorizontalAlignment = HorizontalAlignment.Stretch,
                                   Height = 25,
                                   Width = 25
                               };
  
    memberComboParent.Children.Insert(0, rcbCustomRecords);
}
0
Dimitrina
Telerik team
answered on 13 Aug 2014, 07:53 AM
Hi,

This seems strange. It should mean the RadDataFilter does not have such a child you actually added. Did you modified its template to include this additional element?
I am not sure if your scenario can be really accomplished, however, if you open a support ticket and send me a demo application illustrating the issue, I will check it locally.
That way I will be able to advise further.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
WILLIAM
Top achievements
Rank 1
answered on 13 Aug 2014, 12:50 PM
I have not modified the template.  Since I want to add a combo box at the top and there are several templates I don't want to have to re-invent the wheel.  Based on what I've seen during the debugging process, the template has already been chosen, I'm simply adding a control at runtime.  Is there a way to have a single template (that I create) with a StackPanel that has one child, the combo box I'm wanting to add, and then add your template as another child of the stack panel I created?  I don't want to have to re-create all of your controls and their respective functionality.

Thanks!!
0
Dimitrina
Telerik team
answered on 15 Aug 2014, 11:10 AM
Hello,

I am not sure how and when are you adding the control at runtime. Then, you ask about placing both a new ComboBox and RadDataFilter in one StackPanel. If you do so, then those two controls will be independent and the ComboBox will not be a child of the RadDataFilter.

You can try editing the template of RadDataFilter and check what information you can access that way.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
WILLIAM
Top achievements
Rank 1
answered on 15 Aug 2014, 02:04 PM
I think your miss understanding.  I'm not adding another RadDataFilter control.  I'm only adding a StackPanel and a ComboBox.  Please see the attachment on my original post.  This is what I'm trying to accomplish, but I want to do it at run time, not through a template, because I would basically need to recreate all of the parts of your internal template.  All I want is a comboBox on top of your filter (as in the picture attached in my first post).  Then subscribe to that's comboBox's selection changed event, and then populate your Member filter comboBox with a filtered list of items to choose from.  I'm doing this in the EditorCreated event that you mentioned; I have no problem doing this when a different event fires.
0
Dimitrina
Telerik team
answered on 19 Aug 2014, 12:54 PM
Hi,

You can check this forum thread on a similar topic.
As another way to get all the available members, I can also suggest you subscribing for the SelectionChanged event of RadComboBox control.
For example:
this.AddHandler(RadComboBox.SelectionChangedEvent, new System.Windows.Controls.SelectionChangedEventHandler(OnSelectionChanged));
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
    var combo = (e.OriginalSource as RadComboBox);
    if (combo.Name == "PART_SimpleFilterMemberComboBox")
    {
        // returns only members starting with the letter N
        combo.ItemsSource = ((e.OriginalSource as RadComboBox).DataContext as FilterViewModel).SimpleFilter.AvailableMembers.Where(x => x.PropertyName.StartsWith("N")).AsEnumerable();
    }
}

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
DataFilter
Asked by
WILLIAM
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
WILLIAM
Top achievements
Rank 1
Share this question
or