Posted: 18 Jul 2016 18:33 EDT Last activity: 4 Nov 2016 7:20 EDT
I was trying to make a custom button in a section and found that the code which is generated OOTB has a data-click attribute. I want to actually create a div element which will be getting refresh on its own in some time and on refresh will be calling the onclick event of my custom button. But the code which is getting generated does not have anything like ONCLICK. Please help me in understanding what actually this data-click is and how to fireEvent data-click?
***Moderator edit: Vidyaranjan| Included Category ***
Regarding your query on data-click, I find that this attribute gets added to UI elements(say button) when action(say refresh this section) and events(say for mouse click) are added under Actions tab of the UI control element.
Below is the code at runtime for the button with action(refresh the section) and event set:
I did understand what data-click is. The problem is that I have to open a modal window on the click of a button (the button will not be clicked by anyone as such, it needs to be an automated click which will open the modal windows for me. Consider there is a button with no name, so, it won't appear on the UI and the button has an onclick event attached to it, I need to call that onclick event of the button to open a modal window to perform some work on the Work Object opened in the Modal Window. I have been trying many ways but unable to open it in a popup, rather it in the harness itself.
data-eventname attribute are generated automatically whenever auto generated controls are configured with events and corresponding action.
Instead of generating event handlers on individual components, we generate these data- attributes. This way we don't need to attach the event listeners again when section refresh happens.
How does event works just by this data- attribute ?
We actually listen to events happening in the body, and when event happens on the control / target element it gets bubbled up and stops as and when it reaches the HTML body, here we have logic to extract the necessary attributes and to invoke the respective JS APIs.
My requirement is open a work object to process it in a modal window. I have been trying to use the code which gets generated as a source html and used it in the button's on click function. But i don't know why does not it work the same way as it was doing when a non custom button was used. Could you please tell me a way I can open a modal window and open a work object (open the assignments directly not the review harness of the work object) in it and allow the users to work on it. The button will be a custom one for sure.
If you are looking to launch a local action in modal, then you can very well use Launch -> Local action (via modal). But this doesn't mean that you can move the work object from one assignment to other assignment(via modal dialog). That is possible only using Launch -> flow in modal dialog action. Being said that your requirement is not possible to achieve within PRPC guardrails.