We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11365
    • 39 Posts
    Hi
    I’ve created custom manager page that returns data from table.
    How can I use MODExt to show and edit that?
    I found this code in documentation:
    MyComponent.grid.MyGrid = function( config ) {
        config = config || {};
    
        /* Grid configuration options */
        Ext.applyIf( config, {
            id : "mycomponent-grid-mygrid",
            title : _( "my_grid" ),
            url : MyComponent.config.connectors_url + "list.php",
            baseParams : {
                action : "getlist"
            },
            paging : true,
            autosave : true,
            remoteSort : true,
            /* Store field list */
            fields : [ {
                name : "id",
                type : "int"
            }, {
                name : "name",
                type : "string"
            }, {
                name : "menu"
            } ],
            /* Grid ColumnModel */
            columns : [ {
                header : _( "id" ),
                dataIndex : "id",
                sortable : true
            }, {
                header : _( "name" ),
                dataIndex : "name",
                sortable : true
            } ],
            /* Top toolbar */
            tbar : [ {
                xtype : "button",
                text : _( "create" ),
                handler : {
                    xtype : "mycomponent-window-create",
                    blankValues : true
                },
                scope : this
            } ]
        } );
    
        /* Class parent constructor */
        MyComponent.grid.MyGrid.superclass.constructor.call( this, config );
    };
    
    Ext.extend( MyComponent.grid.MyGrid, MODx.grid.Grid, {
        /* Class members will go here */
    } );
    
    /* Register "mycomponent-grid-mygrid" as an xtype */
    Ext.reg( "mycomponent-grid-mygrid", MyComponent.grid.MyGrid );
    


    but I don’t know where to place this js and how to connect it...

    Help!)
      • 27519
      • 275 Posts
      Building CMP’s isn’t trivial.

      The best approach is to download and install modExtra component and see how that is implemented and try to modify it to work for you.

      I’ve posted quite a number of questions over the past weeks on developing CMP’s on this forum; they’re a good source of information as well.

      Other than that, learn as you go along... grin

      If I ever get a bit of spare time I will write a tutorial with my endeavours.
        MODx Revolution / MAMP / OS X
        • 11365
        • 39 Posts
        Thank you)
        PS Tutorial will be very ueseful!