Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Making custom component in assets pane gain focus and context after reload

Vote:
 

I've got a custom component in the assets pane. It "is" a _ContentContextMixin.

After doing a full reload in the browser I've got two problems:

1. The contextChanged method isn't invoked.

2. The Blocks component gains focus. Given that it's located below my component and my component's height is about the height of the assets pane the assets pane is scrolled down to the Blocks component.

Regarding #1 I'm guessing that that's the expected behavior and I should instead do something with widget command provider or something like that? Either way I'd really like some pointers :)

Regarding #2 I'm guessing my component should also "demand" focus? IF so, how can I ensure that it does it last? Or, can I disable the Blocks component from putting it self in focus?

#66278
Feb 26, 2013 11:34
Vote:
 

I should add that the above is in a context where the assets pane is pinned.

#66279
Feb 26, 2013 11:37
Vote:
 

For the issue I'm guessing that when your component loads the context is already available so no context change event is triggered. If this is the case you can call the method getCurrentContext. This will return either the context or a deferred which will resolve when the context is available. For example:

 

Deferred.when(this.getCurrentContext(), function(context){
    console.log("This is the context:", context);
});

    

#66292
Feb 26, 2013 15:01
Vote:
 

Thanks Ben, works great!

#66294
Feb 26, 2013 15:10
Vote:
 

The gadgets should not "steel" focus when the page is reloaded so I have created a bug for that problem.

I do not have a perfect workaround for this problem until the bug has been fixed, but if you set focus yourself when e.g. the deferred for this.getCurrentContext() is resolved it is more likely to happen after the shared blocks gadget get it.

#66299
Feb 26, 2013 15:33
Vote:
 

Thanks. Since it's only a problem if the default group with blocks and files isn't collapsed I don't think it's a big deal but nice to know there's a workaround.

A completely separate thing, but can't you guys move the line of code where you set query options for the grid in the fetchData method in ContentQueryGrid to a property and/or separate method? Would be nice to more easily override the default sorting (by name descending) :)

#66301
Feb 26, 2013 15:45
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.