How to disable Drag and Drop in Smart UI

Hello Smart Viewers, 🖐️

Together with @jakubkares we figured out how to globally disable the Drag and Drop in the NodesTable widget. (The reason being one of the customer's requests).

Turns out all you have to do is have a Smart UI SDK module deployed, and setting a flag inside of your -extensions.json, like so:

"csui/widgets/nodestable/nodestable.view": {
    "enableDragNDrop": false
}

How does it work:

  • When nodestable gets loaded, it checks all the configuration pointing at it. It does this using special requirejs module, called "module".
  • https://requirejs.org/docs/api.html#config-moduleconfig
  • Opentext did some magic with this, so Smart UI automatically merges all the -extensions.json files into one big config, and all you need to do is call module.config() from the file to get the relevant config.
  • 💡 Nodestable.view leverages this and (together with other stuff) loads the "enableDragNDrop" flag.

I checked the older SDKs and it seems this options has been added in CS version 21.1 (Thanks OpenText! 😊)

So if you want to make use of this, make sure you have at least CS 21.1.

Jan

Tagged:

Comments

  • By the way, there is a KB article on this topic with an enhancement request that is going to be way more user-friendly.

    If you'd like that, please add your voice:

    https://knowledge.opentext.com/knowledge/llisapi.dll/kcs/kbarticle/view/KB14872871

  • You mention the SDK module... can you tell me where and what that is? I've unzipped the 21.1 SDK but don't see anything that's obviously a module. (no ospace folder, e.g.)

  • Hello Greg, I'll explain.

    What you need is the "generator-csui-extension-21.1".

    The "csui-sdk-21.1" is actually completely optional, and only good for learning about Smart UI and borrowing code snippets.

    The "generator-csui-extension-21.1" is the part capable of generating a "Smart UI Extension project" - the actual place where you develop your code. Make sure to unzip it on some place where you won't move it from, as the installation process makes a symlink in node to that location.

    After installing the "generator" you can create your project, in different folder, using yeoman (via the command "yo csui-extension").

    After developing, to compile the project you run another command ("grunt"). The output of the command is "out-module" and "out-release" folders which can be used to create the actual OScript module inside of Eclipse with CS SDK plugin installed.

    You only need to create the module in Eclipse once, after deploying it into the CS you can just replace the contents in support folder with files from "out-release" going onward.

    It's a thorny road I remember being a huge hurdle when I was starting with Smart UI, so feel free to ask me about details if you get errors.

    PS: The module generation was changed, as of SDK 21.4, where the "out-module" directory is not generated anymore. See Ferdi's comment #10 at the bottom:

    https://forums.opentext.com/forums/developer/discussion/309321/out-module-directory-missing-during-the-project-build

    Have a great day,

    Jan