Ext.namespace('MODx', 'AjaxPoll');
AjaxPoll = function(config) {
config = config || {};
Ext.applyIf(config,{
base_url: MODx.config.context_url,
connectors_url: MODx.config.context_url + 'core/connectors/',
tabs: [{
contentEl: 'tab_polls',
title: _('polls')
},
{
contentEl: 'tab_tools',
title: _('tools')
}],
components: [{
xtype: 'grid-ajaxpoll',
el: 'grid_ajaxpolls'
},
{
xtype: 'panel-tools',
el: 'panel_tools'
}]
});
AjaxPoll.superclass.constructor.call(this, config);
this.config = config;
};
Ext.extend(AjaxPoll, Ext.Component, {
config: {}
});
Ext.reg('ajaxpoll', AjaxPoll);
AjaxPoll = new AjaxPoll();Ext.extend(AjaxPoll, Ext.Component, {var AjaxPoll = function(config) {
config = config || {};
Ext.applyIf(config,{
base_url: MODx.config.context_url,
connectors_url: MODx.config.context_url + 'core/connectors/',
tabs: [{
contentEl: 'tab_polls'
,title: _('polls')
},{
contentEl: 'tab_tools'
,title: _('tools')
}],
components: [{
xtype: 'grid-ajaxpoll',
renderTo: 'grid_ajaxpolls' // change el: to renderTo:
},{
xtype: 'panel-tools',
renderTo: 'panel_tools'
}]
});
AjaxPoll.superclass.constructor.call(this, config);
// no need to set this.config, it's auto-set in MODx.Component
};
Ext.extend(AjaxPoll, MODx.Component);
Ext.reg('ajaxpoll', AjaxPoll);
// note that i changed this to ap, since otherwise
// you are overwriting the class definition
var ap = new AjaxPoll();Thanks, I’m new at this Ext stuff.
Actually, your code will work better like this:
var AjaxPoll = function(config) { ... var ap = new AjaxPoll();
(by the way, there is a MODx.config.connectors_url and MODx.config.base_url as well...)

1. Yes.
As for why the grid isn’t working...well, a lot of things.
1. Is the HTML element you’re rendering to a <div> element?
2. Is the JavaScript included _after_ the HTML element is defined?
3. What errors are generated when the grid doesn’t render? What happens?
Error: types[config.xtype || defaultType] is not a constructor Source File: http://localhost/revolution/manager/assets/ext2/ext-all.js Line: 12086
AjaxPoll.grid.AjaxPoll = function(config){
config = config || {};
Ext.applyIf(config, {
title: _('polls'),
url: AjaxPoll.connectors_url + 'ajaxpoll.php',
paging: true,
autosave: true,
remoteSort: true,
primaryKey: 'poll_id',
fields: [{
name: 'poll_id',
type: 'int'
}, {
name: 'start_date',
type: 'date',
dateFormat: 'timestamp'
}, {
name: 'topic',
type: 'string'
}, {
name: 'votes',
type: 'int'
}, {
name: 'status',
type: 'int'
}, {
name: 'menu'
}],
columns: [{
header: _('poll_id'),
dataIndex: 'poll_id',
width: 50,
sortable: true
}, {
header: _('start_date'),
dataIndex: 'start_date',
width: 100,
sortable: true,
renderer: Ext.util.Format.dateRenderer('M j, Y g:i A')
}, {
header: _('topic'),
dataIndex: 'topic',
editor: {
xtype: 'textfield',
allowBlank: false
},
sortable: true
}, {
header: _('votes'),
dataIndex: 'votes',
width: 100,
sortable: true
}, {
header: _('status'),
dataIndex: 'status',
width: 100,
sortable: true,
editor: {
xtype: 'combo-ajaxpoll-status'
}
}],
tbar: [{
text: _('new_poll'),
handler: {
xtype: 'window-ajaxpoll-create',
blankValues: true
}
}]
});
AjaxPoll.grid.AjaxPoll.superclass.constructor.call(this, config);
};
Ext.extend(AjaxPoll.grid.AjaxPoll, MODx.grid.Grid, {
update: function(itm, e){
//
}
});
Ext.reg('grid-ajaxpoll', AjaxPoll.grid.AjaxPoll);
editor: {
xtype: 'combo-ajaxpoll-status'
,renderer: true
}

AjaxPoll.combo.PollStatus = function(config) {
config = config || {};
Ext.applyIf(config, {
name : 'status',
hiddenName : 'status',
displayField : 'name',
valueField : 'id',
triggerAction : 'all',
mode : 'local',
editable : false,
width : 150,
store : new Ext.data.SimpleStore({
fields : ['id', 'name'],
data : [['0', _('closed')], ['1', _('open')], ['2', _('hidden')]]
})
});
AjaxPoll.combo.PollStatus.superclass.constructor.call(this, config);
};
Ext.extend(AjaxPoll.combo.PollStatus, MODx.combo.ComboBox);
Ext.reg('combo-ajaxpoll-status', AjaxPoll.combo.PollStatus); if (this.isLoaded || b == true) { if (this.isLoaded || b == true || this.mode == 'local') {function comboGridRenderer(value) {
var record = statusStore.getById(value);
return record ? record.data.name : value;
}