Hi,
I am new to MODx and trying to learn as I build a custom component. I basically need advice on how to get data displayed in a grid from a custom processor.
My processor currently gets an array of data via web services. Right now, I am stuck at understanding how to build a custom processor without using a database ($classKey) for data. My processor should get data and then send it back to the JavaScript to display in a grid.
Do I need to format the array of data in JSON in order to have it display in a ExtJS grid? When I try to use
the JSON object is empty. What is the correct formatting the array should be in order to turn it into JSON?
/processors/mgr/myextra/receive.class.php
:
class ReceiveProcessor extends modObjectGetListProcessor{
public function initialize() {
return parent::initialize();
}
public function process() {
$data = $this->getCompleted();
// $data looks like ->
// Array(
//[1] => Submission Object(
// [name] => Tom
// [date] => 12345678
// [otherinfo] => Male
// ...
//) ...
//$list = $this->iterate($data);
//$output = $this->toJSON($list);
//return $this->outputArray($list,$data['total']);
return '';
}
JS Example:
MyExtra.grid.Receive = function(config) {
config = config || {};
this.sm = new Ext.grid.CheckboxSelectionModel();
Ext.applyIf(config,{
id: 'myextra-grid-receive'
,url: MyExtra.config.connectorUrl
,baseParams: { action: 'mgr/myextra/receive' }
,fields: ['id','name','date','otherinfo']
...
[ed. note: dnelson last edited this post 12 years, 11 months ago.]