How to fetch the buttons of page title component in script?

  • 1
  • Problem
  • Updated 2 years ago
  • Solved
  • (Edited)
I have two buttons in a page title component. On clicking one of the buttons,the color of the button changes and some fields are updated. This is handled through a script. At any point of time only one button will be highlighted. In my script, I am fetching the component and the buttons.

skuid.component.getById('xxxxxxx') and then the buttons using skuid.component.getById('xxxxxxx').element.buttons

This works fine in version 7.36.1 and there are two button elements returned


But in the latest release, 8.11, this breaks. The buttons array has no elements.


I really am not sure if this is a good way to fetch the buttons in the script. Or rather any component. Please suggest.
Photo of Sneha

Sneha

  • 624 Points 500 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,004 Points 20k badge 2x thumb
The best way to fetch a Page Title Button would be to give each button a Unique Id, so that you can reliably fetch a particular button and interact with it as needed via skuid.component.getById('MyButtonId') to get the Skuid Component instance for the Button or skuid.$('#MyButtonId') to get the DOM Element for the Button. And other approach for retrieving a Page Title's buttons is not supported.