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

1, 2, 3, etc. showing as separate headers

3 Answers 46 Views
JumpList
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Paras
Top achievements
Rank 1
Paras asked on 20 Jun 2012, 07:51 AM
Hi,

If I have a list bound to the JumpList which has various items starting with different numbers, then the jump list grouping is shown with different numbered headers instead of all of them combined under #.

I could reproduce this easily with the sample provided as well by adding values starting with different numbers to the sample data file.

Please see the attached screenshot for details. How do I combine all the values starting with numbers under one group '#'?

Regards,
Paras Wadehra
Twitter: @ParasWadehra

3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 20 Jun 2012, 10:05 AM
Hi Paras,

Thanks for writing and for your question.

This can be easily done by returning the "#" symbol as a group key for all items that start with a number. You can do this in the group key selector unless you are using a PropertyGroupDescriptor instead of generic group descriptor.

Let me know if you need further assistance.

Kind regards,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Paras
Top achievements
Rank 1
answered on 21 Jun 2012, 01:56 AM
Hi Deyan,

I have the following code in my project. Some of the contacts have names starting with different numbers in the list. How do I combine them into one group # from here?

GenericGroupDescriptor<stringstring> groupByFirstName = new GenericGroupDescriptor<stringstring>(contact => contact.Substring(0, 1).ToLower());
this.jumpList.GroupDescriptors.Add(groupByFirstName);

Thanx.
0
Accepted
Deyan
Telerik team
answered on 21 Jun 2012, 07:20 AM
Hello Paras,

You just need to check whether the first character of the group key is a number. If yes, you return the '#'  symbol in the group descriptor instead of the number itself. If the first character is not a number, you just return the character itself. As simple as that:

GenericGroupDescriptor<string, string> groupByFirstName = new GenericGroupDescriptor<string, string>(
(string key) =>
{
    char firstCharacter = key[0];
    if (char.IsDigit(firstCharacter))
    {
        return "#";
    }
    return firstCharacter.ToString().ToLower();
}
);
this.jumpList.GroupDescriptors.Add(groupByFirstName);

I hope this helps.

Regards,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
JumpList
Asked by
Paras
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Paras
Top achievements
Rank 1
Share this question
or