Hello!
I'm having a problem with a grid in a CMP.
The "Doodle"-Tutorial worked fine, so I set up a clear MODX development installation to start developing an extension in.
Everything fine, so far, too. But: The grid, I want to fill, stays empty.
Checking the calls using FireBug showed, that the "connector.php" returns an unsuccessfull state 401.
My directory structure looks as follows:
http://domain.local
+-> /dev
| +-> /dbbbookings
| +-> ...
+-> /modx
In /dev/dbbbookings my extension to develop resides, while the MODX installation is under /modx.
Here comes the code of my grid, which is in file "resourcetype.grid.js".
DBBBookings.grid.ResourceType = function(config) {
config = config || {};
Ext.applyIf(config, {
id: 'dbbbookings-grid-resourcetype',
url: DBBBookings.config.connectorUrl,
baseParams: { action: 'mgr/dbbbooking/getResourceTypeList' },
fields: ['id', 'name', 'menu'],
paging: true,
remoteSort: true,
anchor: '97%',
autoExpandColumn: 'name',
columns: [{
header: _('id'),
dataIndex: 'id',
sortable: true,
width: 60
},
{
header: _('dbbbookings.name'),
dataIndex: 'name',
sortable: true,
width: 350,
editor: { xtype: 'textfield' }
}]
});
DBBBookings.grid.ResourceType.superclass.constructor.call(this, config);
};
Ext.extend(DBBBookings.grid.ResourceType, MODx.grid.Grid);
Ext.reg('dbbbookings-grid-resourcetype', DBBBookings.grid.ResourceType);
My "home.panel.js" contains the code
DBBBookings.panel.Home = function(config) {
config = config || {};
Ext.apply(config, {
border: false,
baseCls: 'modx-formpanel',
cls: 'container',
items: [{
html: '<h2>'+_('dbbbookings.management')+'</h2>',
border: false,
cls: 'modx-page-header'
},
{
xtype: 'modx-tabs',
defaults: { border: false, autoHeight: true },
border: true,
items: [...
{
title: _('dbbbookings.options'),
defaults: { autoHeight: true },
items: [{
html: '<p><strong>'+_('dbbbookings.resource_types')+'</strong></p><p>'+_('dbbbookings.resource_types_desc')+'</p>',
border: false,
bodyCssClass: 'panel-desc'
},
{
xtype: 'dbbbookings-grid-resourcetype',
cls: 'main-wrapper',
preventRender: true
},...]
}],
listeners: {
'afterrender': function(tabPanel) {
tabPanel.doLayout();
}
}
}]
});
DBBBookings.panel.Home.superclass.constructor.call(this, config);
};
Ext.extend(DBBBookings.panel.Home, MODx.Panel);
Ext.reg('dbbbookings-panel-home', DBBBookings.panel.Home);
And my "connector.php" looks as follows:
<?php
require_once dirname(dirname(dirname(dirname(__FILE__)))).'/config.core.php';
require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
require_once MODX_CONNECTORS_PATH.'index.php';
$corePath = $modx->getOption('dbbbookings.core_path', null, $modx->getOption('core_path').'components/dbbbookings/');
require_once $corePath.'model/dbbbookings/dbbbookings.class.php';
$modx->dbbbookings = new DBBBookings($modx);
$modx->lexicon->load('dbbbookings:default');
// Handle request.
$path = $modx->getOption('processorsPath', $modx->dbbbookings->config, $corePath.'processors/');
$modx->request->handleRequest(array(
'processors_path' => $path,
'location' => '',
));
The part of the SQL-Schema, which is interesting for the code above is:
<?xml version="1.0" encoding="UTF-8"?>
<model package="dbbbookings" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.0">
<object class="DBBBookingsResourceType" table="dbbbookings_resource_type" extends="xPDOSimpleObject">
<field key="name" dbtype="varchar" precision="32" phptype="string" null="false" default="" />
</object>
And my processor, that should be called, resides in file "getresourcetypelist.class.php" and contains
<?php
class DBBBookingsGetResourceTypeListProcessor extends modObjectGetListProcessor {
public $classKey = 'DBBBookingsResourceType';
public $languageTopics = array('dbbbookings:default');
public $defaultSortField = 'name';
public $defaultSortDirection = 'ASC';
public $objectType = 'dbbbookings.DBBBookingsResourceType';
}
return 'DBBBookingsGetResourceTypeListProcessor';
I checked for any "Doodle"-stuff in my new code files, cross checked anything, any line, but unfortunately I cannot find any reason for this behaviour.
FireBug also says that "this.table is undefined", but I think this is an preceeding error, which occures because of the unsuccessfull state of the connector.
Does anyone has a clue? I would really appreciate any help.
Thanks in advance,
Dennis
[ed. note: blnguy79 last edited this post 12 years, 6 months ago.]