Sitecore SPEAK and Javascript

413 Views Asked by At

I am trying to replicate what is shown in this video series by Jakob:

I am able to get everything work except the custom Javascript part.

define(["sitecore"], function (Sitecore) {
var ListPage = Sitecore.Definitions.App.extend({
    initialized: function () {
      alert('Test');
      }
  });
  return ListPage;
});

I even tried to fire Sitecore.app command in sc_debug mode but that is returning "undefined"

2

There are 2 best solutions below

1
Komainu85 On BEST ANSWER

if your in Sitecore 7.5 or 8 the app has been moved to Sitecore.Speak.app rather than Sitecore.app

1
Ian Graham On

I believe you have to add a js script file to your Page Code control.

On the Page Code Control there is field called PageCodeScriptFileName you can add a path to your custom js file there. Then you can add your code above in that js file.

There's more info on this blog post from Martina:

http://mhwelander.net/2014/07/01/speak-for-newbies-part-4-pagecode-and-javascript-libraries/