I'm using layout.registerView to create view in ch...
# suitecommerce
n
I'm using layout.registerView to create view in checkout. The view is extending Backbone.View, but the beforeShowContent method isn't firing. Is there a workaround for this, or do I need to use a different way of creating the view?
s
registerView() is intended to be used for views that can be used in any other view. An example of this is the search bar. So if the only scope you require is the checkout, then that’s redundant and may be messing with your events. Secondly, on what object exactly are you calling beforeShowContent? It’s not available on every view.
Also I wrote about events here: https://developers.suitecommerce.com/events.html
And if you want to know about beforeShowContent, then you can read some of the examples where I use it here: https://developers.suitecommerce.com/search.html?keyword=beforeShowContent
n
Hey Steve. I'm calling the method on a backbone view, so I'd assume it's available
s
OK, I don’t think it is
I’m pretty sure it’s built into the page type base view
n
ah, yeah, this isn't a base view
but it would be nice if it were available. I still need to use promises before the view renders
s
Right but there are other ways to call events before render() or showContent() are called
n
I'm refactoring extensions and trying to use the extensibility api as much as possible. I'm not aware of an event I can use for this
s
OK, well beforeShowContent() is only on page type base view AFAIK. Also, if you’re updating customisations to extensions, then you should probably not use Backbone.View. Assuming the site is using 20.2 or newer, you should probably use SCView instead
n
ok, I'll do that
thanks for the response