Quote from: splittingred at Aug 19, 2008, 03:48 AM
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...)
Thanks, I’m new at this Ext stuff.
Quote from: splittingred at Aug 19, 2008, 03:48 AM
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?
1. Yes.
2. Yes, the JS is all at the end of the file.
3. There’s actually one:
Error: types[config.xtype || defaultType] is not a constructor
Source File: http://localhost/revolution/manager/assets/ext2/ext-all.js
Line: 12086
The odd thing is that if I set the xtype to something like "textfield", the element (textfield) renders where it should... I’m wondering if maybe there’s something wrong with the definition of my polls grid (or just something that needs to be changed to be displayed in a tab)?
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);
Thanks for your help!