We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28508
    • 73 Posts
    Hello,

    is there any easy way to make the modx-browser open when the user clicks on an input-textfield
    I created for a self-programmed component? I have no idea how to work with the extJS, is there a way
    without meddling around a lot, maybe some kind of simple tutorial or description?

    Thanks in advance,
    stetus
      • 3749
      • 24,544 Posts
      Try an input type of ’file’ for the TV.
        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
        • 28508
        • 73 Posts
        No,

        I can’t use a TV, the browser should open when a user clicks on an input-textfield in a
        self-coded component, not a resource.

        Thank you,
        stetus
          • 3749
          • 24,544 Posts
          Is this a component that’s running in the Manager? I don’t think there’s any documentation for that yet (other than at the extJS site). You’d have to look at the extJS code the Manager uses to do it for file TVs.
            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
            • 27935
            • 16 Posts
            I am trying to do the same thing. Please let me know if you figure it first! I will do likewise

            :)
              • 28215
              • 4,149 Posts
              xtype: ’modx-combo-browser’

              And you’ll need to look for a ’select’ event. Though there’s not much docs for it. Look at how the File/Image TV does it.
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 27935
                • 16 Posts
                splittingred:

                Thank you so much for the tip!

                Two questions.

                1. How to include modext in the frontend
                2. Any suggestions on how I may find the code for the image tv select event?

                  • 27935
                  • 16 Posts
                  Found answer to 2 smiley

                  manager/templates/default/element/tv/renders/input/file.tpl

                  I only need to find out how to get the MODx object

                    • 3749
                    • 24,544 Posts
                    The MODx object is available in the front end as $modx.
                      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
                      • 28508
                      • 73 Posts
                      Hello,

                      thanks a lot for responding!

                      I found the following JS-Code:
                      o = {
                       xtype: 'modx-combo-browser'
                       ,browserEl: 'modx-browser'
                       ,prependPath: false
                       ,prependUrl: false
                       ,hideFiles: true
                       ,fieldLabel: _('static_resource')
                       ,name: 'content'
                       ,id: 'modx-'+id+'-content'
                       ,anchor: '100%'
                       ,maxLength: 255
                       ,value: ''
                       ,listeners: {
                        'select':{
                         fn:function(data) {
                          if (data.url.substring(0,1) == '/') {
                           Ext.getCmp('modx-'+id+'-content').setValue(data.url.substring(1));
                          }
                         }
                         ,scope:this
                        }
                       }
                      };
                      


                      I think I have to define it similar to this (xtype, listener..), but I’m afraid I have no clue how to work with
                      these objects in extJS. I read some tutorials bit I didn’t get is: How do I generate an input field out of that?
                      Is there any show() method which returns the html/js stuff?

                      Thanks in advance,
                      Stetus