Adding a CUI button, getting context item

Hi aras team,

I am adding a cui button to the command bar, but random question...

How can I get the context item for my method? The usual ways don't seem to apply and I am getting an error:

"identifier 'options' has already been declared"

the onClick event I setup has attempted to run against document.item, document.thisItem and I also tried parent :/

All the blogs seem to focus on get selected items in a grid, not the active window item.

Parents
  • "options" is declared as the parameter of your onClick method and has the "itemId" and "itemTypeName" properties. Or you can use window.item.

  • Thanks for this info, is there any documentation on CUI out there? The admin guide is pretty abysmal. I feel like I may run into more situations like this.

  • There are a couple of Aras community projects on github regarding CUI elements that are very helpful. Just search for "aras cui github".

    They cover the most important stuff you need to know. But some of them may be outdated.

    More fancy stuff like the "init Methods" you have to find out on your own.

    Some general tip as soon as you want to build more intelligent buttons

    1. Know the names most important CUI locations (depends on version cause Aras did some restructuring once, which was great fun)
    2. Try to understand how Aras names the CUI Methods.
    3. Try to understand the Promote/MassPromote button (it contains a lot of little UI highlights)

  • I'll keep this in mind. I got my solution working but I have a feeling these other projects will come in handy very soon Slight smile

  • I have long come to terms with the fact that there is no good documentation and never will be. The only support for the community is the debugger and sources.

    I didn't know anything about "options" three days ago. All I did was add a CUI button, an "Item Click" method with one line:

    debugger;

    turned on developer tools in the browser and pressed the my button.

    And voila, now I see the whole context of my "Item Click" method with its parameters, their properties, properties and methods of the "window", "document" etc. And now I know about "options".

    Unfortunately this is the only way to do something beyond the documentation examples.

  • If your are a subscriber, the CUI Admin Guide contains a few (~3?) tiny code samples that covers finding the context item. 

    And some of the technical foundations are described in the patent Aras uses for CUI:

    https://uspto.report/patent/app/20200394055

    (Some of the pictures show a few nice to know details, but in general the patent is no big help.  )

Reply Children
No Data