A question to the Perspective Router implementation in smartUI SDK

Hi
I just finished a demo for a large US Gouvernement agency. The widget draws an event chart using D3 based on data from Connected Workspaces with several custom REST services.
Now I need to use a Backbone Router to intercept the URLs from the clicked D3 charts and to set the perspective accordingly (to avoid reloading the smartUI).
But I am a little bit lost in the smartUI implementation of Routers. I am quite familiar with Backbone Routing, but I need a short description, how to declare the node.perspective.router.js in my view and how to activate it in smartUI.
Or has this router to be added as CSUI extension?

(There is an example greeings.router.js in the sampels. Very clear and common. I am just missing an explanation, how to setup the router. In Backbone, its a simple addition to the main namespace)
Thanks for your Help.
Reiner

Answers

  • Ferdinand Prantl
    Ferdinand Prantl E Community Moderator

    Let's find out if you need to implement a new router, or if you want to navigate using an existing one.

    If you need to navigate to a URL recognised by CSUI or an existing extension, for example: /app. /app/nodes/:id, /app/search/.. etc., you don't need to implement a new router or even to learn about routers.

    If you wrote a new page using a new widget and you need to open it on a new URL like /app/departments/:department, you will have to implement a new router for that route as a part of the job.

    What is it? Or in other words, what are the URLs that you're going to navigate to?

  • Hi
    this is more or less the standard node.perspective.js router application. I'll send you a core link with a short internal demo video (8 min) of the actual widget. This will explain a lot.The idea behind is to provide the user with the possibility to click on a D3 figure and to open the connected workspace associated with this.

    The link is initiated by an surrounding the D3 circles in the SVG. I do have everything, but right now to show them the possibilities, I am using [OT base]/cs.exe/app/nodes/[oid], which works of course but also of course is reloading the smartUI.
    For demo purposes ok, but obviously not for production.

    And, as of the scope in D3, within the link I do not have access to the context.getmodel and set("id",****) methods from within the D3 attribute set. Thats why a router is useful.
    And the route to /app/nodes/:[oid] (if set as test in D3 circle) is not triggering the router in my widget.
    Thats why I thought, I am missing some init or so.
    Greetings
    Reiner

  • Hi,
    I have created a custom widget similar to myassignments and have similar expansion mode in my custom widget .Now when I try to clcik expansion mode in my custom widget I have to trigger my customized code but by default myassignments content server code is called.How we can find the routing path and change to our custom widgets path.