This content has been marked as final. Show 5 replies
A Dynamic action can be a good solution:1 person found this helpful
- I would give the buttons a classname like 'myLinkButton'
- To make it easy, also give the column with the primary key a classname like 'myKey'
- Then create a Dynamic action using the button class as selector (best use live binding when working with a report)
.myLinkButton // or #myReportId .myLinkButton //If using the same button class on multiple reports
- Then open the modelpage using the page item to set the id. Use &page_item_id. to pass it in the URL.
/* this.triggeringElement => gives back the button .closest('tr') => gives back the button's row .find('.myKey') => gives back the column with the key (also can use the selector 'td[header="headerName"]', then you don't need to give a classname) .text() => gives the text within the selected column. */ var key = $(this.triggeringElement).closest('tr').find('.myKey').text(); // then you can use the $s function to set the value of an hidden pageitem.
<li>Column Link: Provide a link text</li>
onclick="return false;" class="show_modal"
<li>Set the target page and provide any items you want filled.</li>
onclick="return false;" is to prevent the default behaviour of the anchor tag: navigate to the location specified in the href attribute. We want to open the modal page instead.
Now to have the modal dialog open, create a dynamic action.
<li>Selection Type: jQuery Selector</li>
<li>Advanced > Event Scope: live (so the links will work after pagination)</li>
For the true action, select the SkillBuilders Modal Page plugin, and make sure these are specified as following. This will take the location in the generated link columns and open a modal page for this location.
So, this would open your edit page with the correct id (which you set up in the column link).
<li>URL Location: Attribute of Triggering Element</li>
<li>Attribute Name: href</li>
Briliant sollution! I didn't notice the attribute 'url location'. But that's a very neat way of opening the modal page plugin. It works!
Dan McGhan has made a webinar about the modal plugin and how to use it. The sollution above is explained there and a lot more options. A must see if you want to use this plugin! He explains a lot more then the documentation states.
It is based on v1.0.0 of the plugin, but still valid voor v2.0.0.
I followed the .show_modal method in this thread and it works great. But, can anyone tell me: how do I refresh the parent after the modal has closed?