10 Replies Latest reply on May 5, 2016 10:58 AM by Ryan Rutan

    view for the carousel tile

    sbollap1 Intermediate

      From the tutorial of creating a carousel tile, Getting Started > Creating a Carousel Tile with the Jive Node SDK 

      i am seeing that the getFormattedData () method is not even getting called. I am only seeing the the sample data configured from the definition.json. i wanted to know if i want to do a request.execute () where should i make this request? should i be making it in this file main.js which has the following? i am trying to change the data based on the response i get from request.execute() .


      (function() {
          jive.tile.onOpen(function(config, options ) {
              if ( typeof config === "string" ) {
                  config = JSON.parse(config);
              var json = config || {
                  "startSequence": "1"
              // prepopulate the sequence input dialog
              $("#start_sequence").val( json["startSequence"]);
              $("#btn_submit").click( function() {
                  config["startSequence"] = $("#start_sequence").val();
                  jive.tile.close(config, {} );


      or in the services.js file ?


      if i want to extend the example with a custom view but i don't see the view.html as i would see it with creating a custom tile. would appreciate any insight.

      also, i am trying to understand what this means by  get.js below

      You can also create a unique configuration page by updating the configuration HTML content in tiles/sampetile-carousel/public/configuration.html and the JavaScript configuration content intiles/sampetile-carousel/backend/configure/get.js.

      because i don't even see the configure dir in backend dir. when i created the tile out of the box.

        • Re: view for the carousel tile
          Scott A Johnson Advanced

          Hi Shan,


          If you wanted to dynamically update the data in your Carousel tile based on a the response from a web service, you would want to put this in the getFormattedData function in services.js.


          To better understand this tile, lets have a look at what the various files are doing.


          configuration.html, as the name implies is the default page loaded when configuring the tile. This is shown here:


          Looking at the source of this page, it loads a javascript file main.js.


          main.js, calls jive.tile.onOpen() which retrieves the configuration and tile options for this tile. In this context, it is used to load or create the config property "startSequence", then, based on the user's input, saving that property using the function jive.tile.close().


          As this is a Carousel style tile as defined in definition.json, "style": "CAROUSEL", a view.html file doesn't make sense, as the view is determined by the out of the box carousel view, not by a custom view as with Custom View Tiles.


          Out of the box style tiles are affected only by the data passed to them, not any outside rendering.


          That takes us to the services.js file. This file pushes data into any registered instances of this tile definition every 60 seconds. This is controlled by the export.tasks block shown here:


          exports.task = [
                  'interval' : 60000,
                  'handler' : pushData


          The single task defined here says to call the pushData function every 60000 milliseconds.


          The pushData function retrieves any tile instance of the tile-definition named 'sampletile-carousel'. For each instance, it calls the function processTileInstance which looks up count data from a datastore called 'exampleCarouselStore', increments it, saves it back to the data store, then calls getFormattedData with the original count value then pushes the formatted data retrieved from getFormattedData to the tile instance.


          If you're not seeing getFormattedData being called, it could be a number of things, but the first check I would do is verify that tiles that you're creating in Jive are being registered properly with your node server.


          You can do this by checking the datastore saved in db/tileInstance.json


          More info about tiles api can be found here: Tile API & Development FAQ


          Edit: I wrote all this without testing. Then I tested the example code and found that it was missing a key file which you noted in your question: backend/routes/configure/get.js, below is the info you need to include to make configuring and registering your tile work!

          Sample backend/routes/configure/get.js


          var jive = require("jive-sdk");
          exports.route = function(req, res) {
            res.render('configuration.html', { host: jive.service.serviceURL()  });
            • Re: view for the carousel tile
              sbollap1 Intermediate

              From this Getting Started > Creating a Carousel Tile with the Jive Node SDK   the prerequisites point #2. says that you need to be able to install an add-ons on the jive server for this tutorials. I would like to know if this means access to be able to Upload the package via the add-on's menu (as shown below). or is it something else? Because i am confused about whether or not i have to have a service running to get this carousel tile working. I would like to know if this carousel tile works in the similar way of building a custom tile where all the assets are in that extension.zip file.



              also, adding this, i made the change you mentioned and included get.js but i am seeing this error and can't add this carousel tile



              looking at the addon page noticed an alert


                • Re: view for the carousel tile
                  Scott A Johnson Advanced

                  Hi Shan,


                  Prerequisite #2 refers to being able to access the Add-on's interface in the Jive instance you're using. It appears you have this access.

                  #3 refers to having a running node server for this add-on which is accessible from the internet. This is what appears to be missing and why your registration and configuration fails.


                  What I while testing this was start the node server on my laptop while running ngrok to create a proxy to that local port. You'll also need to update the jiveclientconfiguration.json->clientUrl to reference your ngrok url.


                  You could just as well serve the add-on from a service like nitrous.io as explained here Using Nitrous.IO with the Jive Node SDK.