We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38181 ☆ A M B ☆
    • 26 Posts
    Ok .... sorry to trouble again just a few minutes later.

    I have a very basic CMP defined:

    ETClient.grid.ETClient = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            border: false
            ,baseCls: 'modx-formpanel'
            ,url: ETClient.config.connectorUrl
            ,baseParams: {
                action: 'mgr/etclient/getClient'
                ,clientid:  MODx.request.clientid
            }
            ,fields: ['lastname']
            ,id: 'etclient-grid-etclient'
            ,defaults: {
                border: false
            }
            ,items: [{
                html: 'hello world'
            },{
                xtype: 'textfield',
                dataIndex: 'lastname',
                name: 'lastname'
            }]
        });
        ETClient.grid.ETClient.superclass.constructor.call(this,config)
    };
    Ext.extend(ETClient.grid.ETClient,MODx.Panel);
    Ext.reg('etclient-grid-etclient',ETClient.grid.ETClient);


    The DB query is fired but the form field (lastname) is not populated with the data from the db query, it is just displayed as an empty field ..... any ideas why?
      • 38181 ☆ A M B ☆
      • 26 Posts
      PS: I know the extend element is meant to say 'MODx.FormPanel' but if I do that, then no fields are shown on the page at all ....?
        • 1778
        • 659 Posts
        it's a grid, you have to extend MODx.grid.Grid instead of MODX.panel, or MODx.FormPane..
        Hope this helps
        Cheers
          • 38181 ☆ A M B ☆
          • 26 Posts
          Well the code above although calling things 'grid', extended MODx.Panel ..... but I now have moved a little forward. The declaration now looks like this, but still no joy:

          ETClient.panel.ETClient = function(config) {
              config = config || {};
              Ext.applyIf(config,{
                  border: false
                  ,baseCls: 'modx-formpanel'
                  ,url: ETClient.config.connectorUrl+'mgr/etclient/getClient'
                  ,baseParams: {
                      action: 'mgr/etclient/getClient'
                      ,clientid:  MODx.request.clientid
                  }
                  ,id: 'etclient-panel-etclient'
                  ,defaults: {
                      border: false
                  }
                  ,items: [{
                      html: '<h2>'+_('namespaces')+'</h2>'
                      ,border: false
                      ,id: 'modx-namespaces-header'
                      ,cls: 'modx-page-header'
                  },{
                      layout: 'form'
                      ,deferredRender: false
                      ,items: [{
                          xtype: 'textfield',
                          dataIndex: 'lastname',
                          name: 'lastname'
                      }]
                  }]
              });
              ETClient.panel.ETClient.superclass.constructor.call(this,config)
          };
          Ext.extend(ETClient.panel.ETClient,MODx.FormPanel);
          Ext.reg('etclient-panel-etclient',ETClient.panel.ETClient);



          This still fails in the same way. It renders the FormPanel (etclient-panel-etclient) but the data values from the db query don't set the lastname field. It simply displays as a blank textfield, with no data.

          (Interestingly maybe totally irrelevant, the textfield is not allowing any form of 'drag/drop' capability .... drop is not allowed on he field. I was expecting it to be droppable ....

          Tim