Search code examples
sitecoresitecore7.2

Reload Content Editor after selecting language using language switcher


I'm trying to reload content editor content based on selected language as I need to filter items before user can see them. Right now I am able to filter items by inheriting from BucketDataView and overriding GetChildItems method.

Is there a way to refresh content after selecting new language but after filter is called?

If my approach is wrong, what else can I use?

Thanks!

Lukasz.


Solution

  • Working solution

    Create a new command

    [Serializable]
    public class SelectLanguage : Languages
    {
        public override string GetClick(Sitecore.Shell.Framework.Commands.CommandContext context, string click)
        {
            Sitecore.Context.ClientPage.SendMessage(this, string.Format("item:refreshchildren(id={0})", Sitecore.ItemIDs.ContentRoot));
    
            return base.GetClick(context, click);
        }
    
    }
    

    Update \Website\App_Config\Commands.config

    Set <command name="ribbon:languages" type="[Namespace]SelectLanguage ,[assembly]"/>

    In this case I am able to update content tree after selecting new language in language switcher.

    Łukasz.