We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27519
    • 275 Posts
    After some ploughing through the ExtJs API I found the autoload parameter which allows to load content for a panel from a remote location without an explicit call to the server.

    xtype: 'tariffs-panel-month'
    ,title: this.getTitle(1)
    ,html: this.renderMe(1)
    ,width:200
    ,height: 200
    ,autoLoad:{
        url:'mgr/calendar/getmonth'
    }
    


    I implemented the getmonth.php in "mgr/calendar" however content does not appear (a simple "Hello world!" should appear).

    Apparently the php file is not found. I used the same path and call convention as used by the CMP pages in MODx.

    What am I doing wrong?

    Thanks!
      MODx Revolution / MAMP / OS X
      • 28215
      • 4,149 Posts
      URL there is absolute; you’ll need to do this instead (assuming your getmonth.php file is a controller):

      ,autoLoad:{
          url: MODx.config.manager_url+'index.php?action=mgr/calendar/getmonth&a='+123
          ,params: {
              anotherGetParam: 'test'
              ,cool: 'dude'
          }
      }
      


      Where 123 is the ID of the modAction; this can also be gotten by: MODx.request.a

      However, it depends on how you’re handling multiple pages in your CMP, I assume with a custom controller request handler, so then MODx.request.a would work.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 27519
        • 275 Posts
        Thanks for the reply.

        The getmonth.php is not a controller. It’s just a PHP snippet that should return a string of HTML.

        Is it possible to implement it like the action param in modExtra:

        modExtra.grid.Items = function(config) {
            config = config || {};
            Ext.applyIf(config,{
                id: 'modextra-grid-items'
                ,url: modExtra.config.connector_url
                ,baseParams: {
                    action: 'mgr/item/getlist'
                }
        


        or...

        modExtra.window.CreateItem = function(config) {
            config = config || {};
            this.ident = config.ident || 'mecitem'+Ext.id();
            Ext.applyIf(config,{
                title: _('modextra.item_create')
                ,id: this.ident
                ,height: 150
                ,width: 475
                ,url: modExtra.config.connector_url
                ,action: 'mgr/item/create'
        


        I tried that approach but in stead of the expected content I get some source code in the panel.

        Is there a basic difference in handling a request from a form after clicking a submit (like the two examples above from modExtra) vs. requesting content via autoload?

        Thanks again for your help.
          MODx Revolution / MAMP / OS X