We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37099
    • 338 Posts
    I'm working with a custom TV that loads an ExtJS grid.

    When the grid first loads I get an "Access denied" error message.

    But if I then subsequently click on one of the column headings of the grid, the data loads.

    I have tried adding "autoLoad : true" to the grid's configuration values but I get the following error message:

    "syntax error:
    Object not found!
    The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error."

    And the grid doesn't load at all.

    I don't have a lot of experience with ExtJS.

    Can anyone give me any ideas where to start looking?

    Thanks
    Mike

    This question has been answered by Bruno17. See the first response.

      • 4172
      • 5,888 Posts
      not easy to say what goes wrong here, without knowing your code or knowing more about what you are trying todo with the grid.
      wouldn't be a MIGXdb - TV an option for you?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37099
        • 338 Posts
        I'm trying to hack SimpleFileUploadTV so that I can upload images, create manager specified resized versions of that image plus the original, & save those images to a resource based folder and then have a list of those images related to that resource display in the grid on the template variable tab. I'm storing the image details in a table so that descriptions can be added.

        That all works, except the data doesn't initially load until I click the column sort button.

        So I don't think MIGXdb would do that? ( I've not used it)

        I think it might be the order of things that happen in the javascript possibly ....

        It's hard to know what code detail to give....

        This is the template for the TV

        <div id="easyuploadtv{$tv->id}"></div>
        <br>
        <div id="easyuploadList{$tv->id}"></div>
        <script type="text/javascript">
        
            myTV{$tv->id} = MODx.load{literal}({
            {/literal}
                xtype: 'EasyUploadTV',
                renderTo: 'easyuploadtv{$tv->id}',
                ..... the image upload button, removed for brevity .....
            {literal}
            });
            {/literal}
        
            /* My Grid */
            myTV2_{$tv->id} = MODx.load{literal}({
            {/literal}
                xtype : 'mycomponent-grid-mygrid'
                ,renderTo: 'easyuploadList{$tv->id}'
                ,url: '{$assets}connector.php'
                ,baseParams : {
                    action : "/browser/file/getlist"
                }
                ,title : 'Images'
        
            {literal}
            });
            {/literal}
        
        </script>
        



        And this is 'mycomponent-grid-mygrid':

        var MyComponent = function(config) {
            config = config || {};
            MyComponent.superclass.constructor.call(this,config);
        };
        Ext.extend(MyComponent,Ext.Component,{
            page:{},window:{},grid:{},tree:{},panel:{},combo:{},config: {},form:{}
        });
        Ext.reg('MyComponent',MyComponent);
        MyComponent = new MyComponent();
        
        
        MyComponent.grid.MyGrid = function( config ) {
        
            config = config || {};
            var assets_url = this.getAssetsUrl();
        
            /* Grid configuration options */
            Ext.applyIf( config, {
                id : "mycomponent-grid-mygrid",
                title : "My Grid",
                paging : true,
                autosave : true,
                remoteSort : true,
                autoexpandcolumn : "description",
        
        
                /* Store field list */
                fields : [ {
                    name : "id",
                    type : "int"
                }, {
                    name : "name",
                    type : "string"
                }, {
                    name : "description",
                    type : "string"
                }, {
                    name : "menu"
                } ],
                /* Grid ColumnModel */
                columns : [ {
                    header : _( "id" ),
                    dataIndex : "id",
                    sortable : true
                }, {
                    header : _( "name" ),
                    dataIndex : "name",
                    sortable : true,
                    width : 160
                }, {
                    header : _( "description" ),
                    dataIndex : "description",
                    sortable : true,
                    width : 500
                } ]
        
        
            } );
        
        
            /* Class parent constructor */
            MyComponent.grid.MyGrid.superclass.constructor.call( this, config );
        };
        Ext.extend( MyComponent.grid.MyGrid, MODx.grid.Grid, {
            /* Class members will go here */
            getAssetsUrl: function(){
            var assets_url = MODx.config["tveasyimageupload.assets_url"];
            if(typeof assets_url === 'undefined'){
                assets_url = MODx.config.assets_url;
            }
            return assets_url;
        }
        
        } );
        /* Register "mycomponent-grid-mygrid" as an xtype */
        Ext.reg( "mycomponent-grid-mygrid", MyComponent.grid.MyGrid );
        



        Any suggestions much appreciated.

        Thanks
        Mike
          • 4172
          • 5,888 Posts
          I'm sure this is possible with a MIGXdb - TV

          sounds much like this one (its a MIGX - TV, not a MIGXdb-TV):
          http://rtfm.modx.com/display/ADDON/MIGX.Use+resource-specific+mediasource+and+multifile-uploader

          only difference seems to be, it stores its datas as json-string into one TV.
          I'm sure the same principe is possible with a MIGXdb - TV and storing the datas into a custom-table.

          Something like that combined with the above should be possible:

          http://rtfm.modx.com/display/ADDON/MIGXdb.Create+a+basic+gallery-management+from+scratch+with+MIGXdb
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 37099
            • 338 Posts
            Ah, thanks.

            But part of the reason I'm doing it is to learn about ExtJS, and learn about developing custom TVs and Extras.

            I will look at those tutorials and MIGXdb at some point, but at the moment I'd like to learn why my code isn't working.

            Can you shed any light on that?

            Thanks
            Mike
              • 4172
              • 5,888 Posts
              what are the differences between the initial request and the request when refreshing the grid?
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 37099
                • 338 Posts
                Ha ha good question the initial request to the connector is this:

                array (
                  'start' => '0',
                  'limit' => '20',
                  'action' => '/browser/file/getlist',
                )
                


                And the one that works is this:

                array (
                  'start' => '0',
                  'limit' => '20',
                  'action' => '/browser/file/getlist',
                  'sort' => 'name',
                  'dir' => 'ASC',
                  'HTTP_MODAUTH' => 'modx222XXXXXXe2297.2676XXXXXXXX',
                )
                


                I'm clearly missing some values ....

                So I need to work out how to get those in the initial request.

                Thanks
                Mike
                • discuss.answer
                  • 4172
                  • 5,888 Posts
                  you will need at least add something like this to the baseParams:

                  'HTTP_MODAUTH': config.auth


                  I'm setting the config.auth by php with:

                  $controller->setPlaceholder('auth', $_SESSION["modx.{$this->modx->context->get('key')}.user.token"]);
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 37099
                    • 338 Posts
                    Thank you Bruno it now works properly smiley

                    You have saved me hours of head scratching.

                    Cheers
                    Mike