We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19534
    • 183 Posts
    Hey!

    How can I add an additional button via ExtJS (or MODExt) to the ActionToolbar in the MODx manager when displaying a resource? The button should show up a custom dialog when the user clicks on the button.


    Cheers,
    Jakob
      Add-On to easily manage your multilingual sites: Babel
      • 19534
      • 183 Posts
      Ok I found a solution by myself which even needs no JavaScript: The OnResourceToolbarLoad event is my friend to add a button wink

      Cheers,

      Jakob
        Add-On to easily manage your multilingual sites: Babel
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Could you share how you did it?

        May save someone else a lot of time figuring it out when they come across this topic. wink
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 19534
          • 183 Posts
          I had to work on some other stuff but finally I got back to this project and had a deeper look into the MODx core. Unfortunately the OnResourceToolbarLoad event is triggered when building the tool bar of the resource tree (not the action toolbar I’d like to extend).

          So I still haven’t got an answer to my original question: How can I add an additional button to the ActionToolbar in the MODx manager when displaying a resource?

          Something like the OnResourceToolbarLoad event would be very helpful (but I didn’t find anything)...

          Thanks,
          Jakob
            Add-On to easily manage your multilingual sites: Babel
            • 12066
            • 48 Posts
            @mikrobi,

            have you ever found a useful solution for this issue? If yes, would you mind sharing it?

            Thanks..
              • 3749
              • 24,544 Posts
              It's a clunky solution, but a TV's caption can contain HTML defining a button with an onClick event. In theory, you could use Form Customization to put the TV on the panel where you want it and use CSS to place the button anywhere on the page. The Notify Extra uses this method to launch Notify since you always want to launch it for a given Resource.

              The caption field is limited in length -- I think it's 128 or 256 characters.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 12066
                • 48 Posts
                Think I found the first part of the solution:

                case 'OnDocFormRender':
                $js =<<<JS
                    <script type="text/javascript">
                    Ext.onReady(function () {
                        var modab = Ext.getCmp("modx-action-buttons");
                        console.log(modab);
                        modab.add('-');
                        modab.add({
                            xtype: 'button'
                            ,text: 'Vorschau'
                            ,process: 'update'
                            ,params: {
                                id: 5876
                            }
                            ,id: 'modx-abtn-real-preview'
                            ,method: 'remote'
                            ,checkDirty: true
                        });
                        modab.doLayout();
                    });
                    </script>
                JS;
                $modx->regClientStartupHTMLBlock($js);
                


                This adds a button to the MODx action toolbar.
                  • 12066
                  • 48 Posts
                  Hi,

                  is there somebody around who could give me a hint how to solve this MODx/ExtJS problem?
                  What I'm trying to achieve is a fake resource preview, by updating another resource with the current resource's properties.
                  So I'm adding a ExtJS button to the resource toolbar, which works as expected, but I can't manipulate the ID of the resource I want to actually save the properties to.

                  var modab = Ext.getCmp("modx-action-buttons");
                  modab.add({
                      xtype: 'button'
                      ,text: 'Preview'
                      ,method: 'remote'
                      ,process: 'update'
                      ,baseParams: {
                          ID ( I tried several options)
                      }
                      ,success: function(data) {
                          console.log(data);
                          Ext.alert('Success');
                      }
                      ,id: 'modx-abtn-real-preview'
                      ,checkDirty: true
                  });
                  


                  If possible: How can I pass the ID parameter to the processors handling create and update?

                  I'm completely stuck, so any help is highly appreciated.

                  Thanks [ed. note: herooutoftime last edited this post 13 years, 3 months ago.]