This question has been answered by Bruno17. See the first response.
<div id="easyuploadtv{$tv->id}"></div>
<br>
<div id="easyuploadList{$tv->id}"></div>
<script type="text/javascript">
myTV{$tv->id} = MODx.load{literal}({
{/literal}
xtype: 'EasyUploadTV',
renderTo: 'easyuploadtv{$tv->id}',
..... the image upload button, removed for brevity .....
{literal}
});
{/literal}
/* My Grid */
myTV2_{$tv->id} = MODx.load{literal}({
{/literal}
xtype : 'mycomponent-grid-mygrid'
,renderTo: 'easyuploadList{$tv->id}'
,url: '{$assets}connector.php'
,baseParams : {
action : "/browser/file/getlist"
}
,title : 'Images'
{literal}
});
{/literal}
</script>
var MyComponent = function(config) {
config = config || {};
MyComponent.superclass.constructor.call(this,config);
};
Ext.extend(MyComponent,Ext.Component,{
page:{},window:{},grid:{},tree:{},panel:{},combo:{},config: {},form:{}
});
Ext.reg('MyComponent',MyComponent);
MyComponent = new MyComponent();
MyComponent.grid.MyGrid = function( config ) {
config = config || {};
var assets_url = this.getAssetsUrl();
/* Grid configuration options */
Ext.applyIf( config, {
id : "mycomponent-grid-mygrid",
title : "My Grid",
paging : true,
autosave : true,
remoteSort : true,
autoexpandcolumn : "description",
/* Store field list */
fields : [ {
name : "id",
type : "int"
}, {
name : "name",
type : "string"
}, {
name : "description",
type : "string"
}, {
name : "menu"
} ],
/* Grid ColumnModel */
columns : [ {
header : _( "id" ),
dataIndex : "id",
sortable : true
}, {
header : _( "name" ),
dataIndex : "name",
sortable : true,
width : 160
}, {
header : _( "description" ),
dataIndex : "description",
sortable : true,
width : 500
} ]
} );
/* Class parent constructor */
MyComponent.grid.MyGrid.superclass.constructor.call( this, config );
};
Ext.extend( MyComponent.grid.MyGrid, MODx.grid.Grid, {
/* Class members will go here */
getAssetsUrl: function(){
var assets_url = MODx.config["tveasyimageupload.assets_url"];
if(typeof assets_url === 'undefined'){
assets_url = MODx.config.assets_url;
}
return assets_url;
}
} );
/* Register "mycomponent-grid-mygrid" as an xtype */
Ext.reg( "mycomponent-grid-mygrid", MyComponent.grid.MyGrid );
array ( 'start' => '0', 'limit' => '20', 'action' => '/browser/file/getlist', )
array ( 'start' => '0', 'limit' => '20', 'action' => '/browser/file/getlist', 'sort' => 'name', 'dir' => 'ASC', 'HTTP_MODAUTH' => 'modx222XXXXXXe2297.2676XXXXXXXX', )
'HTTP_MODAUTH': config.auth
$controller->setPlaceholder('auth', $_SESSION["modx.{$this->modx->context->get('key')}.user.token"]);