5 Replies Latest reply: Jan 10, 2011 6:27 PM by maceyah RSS

    Dynamic action - Tabular form

      Is there a way to setup a dynamic action in the context of a tabular form? For instance, if one of the columns is a checkbox/radiobutton, highlight the row when it is clicked.

        • 1. Re: Dynamic action - Tabular form

          Suspect it's possible to do anything with Dynamic Actions—if you're prepared to write enough code/twist your brain round a lot of JavaScript and jQuery syntax ;-)

          Something similar was done here: {message:id=4570591}, i.e. you can apply a dynamic action to all the elements in a column of a tabular form using a jQuery selector. In this case the action would apply a class or style to the row containing the triggering element, again probably determining this using a jQuery selector.
          • 2. Re: Dynamic action - Tabular form
            Paul - I guess you are right. It's just that Apex 4.0 has spoiled us with these nifty dynamic actions, I expect everything to be "declarative" with no, gasp, code :-)

            Yes, jQuery selectors are very powerful and Apex has many useful little helper functions, even one for highlighting a row.

            It's just that I am not quite sure how to connect the dots yet ("when this happens, do that") in this case.

            • 3. Re: Dynamic action - Tabular form
              Any ideas or even better working examples? Thanks
              • 4. Re: Dynamic action - Tabular form
                No takers, eh? All right, let me take a shot at this.

                As Paul suggested, using a triggering element type jQuery selector like td["headers='Foo'"] and event=click works fine. The event fires upon clicking anywhere in that cell. A simple alert box works fine but when change the Action to highlight the row using "Execute javascript code", nothing happens, no errors, the row doesn't get highlighted, nothing.

                Here is what I see in the page source
                apex.da.initDaEventList = function(){
                apex.da.gEventList = [
                {"triggeringElement":"td[headers=\u0027Foo\u0027]","triggeringElementType":"JQUERY_SELECTOR","bindType":"bind","bindEventType":"click",actionList:[{"eventResult":true,"executeOnPageInit":false,"stopExecutionOnError":true,"affectedRegionId":"R4789122685736107",javascriptFunction:function (){ $x_RowHighlight(this.triggeringElement, 'pink');},"action":"NATIVE_JAVASCRIPT_CODE"}]}];
                Any idea why this is not working? What am I missing?

                Update: Ah, read up on that $x_RowHighlight, it needs a TR, not a TD. Changing it to

                Clicking in a cell highlights the row but when the mouse is moved outside that report row, the highlighting is gone. Not sure I understand why. Any ideas? Thanks

                Update: OK the #HIGHLIGHT_ROW# in the report template was probably adding its own mouseover/mouseout event and clearing out the color. Getting rid of that took care of the problem.

                I am still not sure how to get at the values of data in the current row in order to do something with them, but that probably needs a separate thread, closing this thread
                • 5. Re: Dynamic action - Tabular form
                  thanks for the tips!