HistoryItems context

4 posts, 0 answers
  1. Yoann
    Yoann avatar
    2 posts
    Member since:
    Dec 2010

    Posted 03 Jan 2012 Link to this post

    Hello,

     I need to change the visibility of an history item (or remove it from history items) of the breadcrumb, depending on user's actions.
     User can display detailed information of an object of the application (for example a customer).
     In that case, the breadcrumb will contain a reference to this detailed information panel in its history items.
     If user deletes this application's object, I want to remove the reference to its detailed panel from the crumbbread bar history items.

     Up to now, I did not find a proper way to match history item with the corresponding deleted object, and there's no data context on the RadBreadcrumbBarItem of the history.
     I can not use the path of the history item because it's not a unique identifier (it contains only a label entered by the user).

     
     Could you please let me know if there's a way to do that match ?

    Thanks

  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 06 Jan 2012 Link to this post

    Hi,
    As you've probably noticed you can modify the items in the History of the RadBreadcrumb by the HistoryItems collection. Unfortunately the history item doesn't have a reference to the item it represents, but it holds the path to it, so at the moment the DropDownHeader(the visible string) of an history item has to be this path otherwise it won't work.
    You can workaround this by creating a custom RadBreadcrumbBarItem with changed Template so that the path is still kept in the DropDownHeader but the visible string is bound to some other property (e.g. Name).
    I've created a sample project that demonstrates this so could you please examine it and tell us if this is what you're looking for?

    All the best,
    Zarko
    the Telerik team

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

  3. DevCraft banner
  4. Yoann
    Yoann avatar
    2 posts
    Member since:
    Dec 2010

    Posted 06 Jan 2012 Link to this post

    Hi,

     Thanks a lot for your quick answer and this demonstration project. 

     The way I'm using the BreadCrumb seems not to be compatible with default way it works, because as I'm displaying a name entered by a user, I'm not sure that there's will not have 2 paths identical, which will be a problem when selecting an item in the history.
     So unfortunately your workaround will not solve my issue. 

     I'll check if I can create a custom BreadCrumb to override the way historyItems are handled.

    Thanks
     
  5. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 11 Jan 2012 Link to this post

    Hi,
    If your user enters two items with identical Names in the History:
    itemOne.Name = "SomeName";
    ...
    itemTwo.Name = "SomeName";
    ...
    this.breadcrumb.HistoryItems.Add(itemOne);
    this.breadcrumb.HistoryItems.Add(itemTwo);
    (this throws an exception)
    there will be problems indeed, but if they are with identical Paths and different Names there shouldn't be any issues:
    itemOne.DropDownHeader = @"Some\Path";
    itemTwo.Name = "nameONE";
    ...
    itemTwo.DropDownHeader = @"Some\Path";
    itemTwo.Name = "nameTWO";
    ...
    this.breadcrumb.HistoryItems.Add(itemOne);
    this.breadcrumb.HistoryItems.Add(itemTwo);
    (this works correctly)
    If you need any further help please feel free to ask.

    All the best,
    Zarko
    the Telerik team

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

Back to Top