We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49222
    • 2 Posts
    After a two hours of experimenting with MIGXdb for the first time I got my use-case up and running. It's about managing event registrations for different events (which are resources).

    Each of my "EventParticipant" objects has a "resource_id" column that is correctly recognized on the MIGX lists & forms. I see correct participants for each resource unter TVs.

    But when exporting the list using "Export Current View" I always get ALL entries from ALL resources not only the current one.

    Is this the default behavior or is there any setting around to change this behavior?

    This question has been answered by Bruno17. See the first response.

      • 4172
      • 5,888 Posts
      you can add a filter, for example a textbox-filter, where you can filter only that one record (by resource_id)
      Then the default-export-processor should respect this filter (I think)
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 4172
        • 5,888 Posts
        of course, it should also be possible to export just one resource with a custom context-menu-item
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 49222
          • 2 Posts
          Hello Bruno,

          thanks for your response! I think there has been a slight misunderstanding.

          My eventParticipant object looks like this:

          * id
          * resource_id (foreign key to "event" page)
          * firstName
          * lastName

          When I list all event participants in TVs I can see the ones that are related to the current resource by "resource_id" which is correct. But when I use the default "Export current view" button it does not export the "current view" but all entries from all events. So I don't want to filter the visible list at all because it is already correct.
          • discuss.answer
            • 4172
            • 5,888 Posts
            you can create a copy of the processor

            components/migx/processors/mgr/default/export.php

            to

            components/{yourpackage}/processors/mgr/default/export.php

            and filter by the current resource_id

            and you will need a customized version of the gridfunction 'this.csvExport' with an additional line:

            params.resource_id = '[[+config.resource_id]]';


            which should send the current resource-id with the request.

            $gridfunctions['this.csvExport'] = "
            	csvExport: function(btn,e) {
            		var s = this.getStore();
            		var code, type, category, study_type, ebs_state;
            		var box = Ext.MessageBox.wait('Preparing ...', _('migx.export_current_view'));
                    var params = s.baseParams;
                    var o_action = params.action || '';
                    var o_processaction = params.processaction || '';
                    
                    params.action = 'mgr/migxdb/process';
                    params.processaction = 'export';
                    params.configs = this.config.configs;
                    params.resource_id = '[[+config.resource_id]]';     
            
            		MODx.Ajax.request({
            			url : this.config.url,
            			params: params,
            			listeners: {
            				'success': {fn:function(r) {
            					 location.href = this.config.url+'?action=mgr/migxdb/process&processaction=export&download='+r.message+'&id='+id+'&HTTP_MODAUTH=' + MODx.siteId;
            					 box.hide();
            				},scope:this}
            			}
            		});
                    
                    params.action = o_action;
                    params.processaction = o_processaction;
                    
            		return true;
            	}
            ";

              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!