We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37743
    • 49 Posts
    in short... does it exist??
    I've trawled through the source (modx-combo & tv-renders) and cant seem to see it anywhere... I just want a (hardcoded) filtered list of resources in a combobox... seems strange that this doesnt exists.
    Is there a TV-combo render lurking somewhere that I can grab or will i need to construct my own connectors/processors to get this list?
      • 1778
      • 659 Posts
      Hello
      Not sure it's of any help for you, but in 'yourmodxinstall/manager/templates/default/element/tv/renders/input/ 'there is 'resourcelist.tpl' which is used by the TV input type Resource List... May be a start point for you ?
      Cheers
        • 34030 ☆ A M B ☆
        • 23 Posts
        There is the 'resource list' TV type that will display a list of resources in a drop-down.

        If you need multiple selection capabilities, I’ve used this tutorial from Mark Hamstra that does a nice job:

        http://rtfm.modx.com/display/revolution20/Creating+a+multi-select+box+for+related+pages+in+your+template
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Nice to see you on the forums too, Cal! wink

          There doesn't seem to be a combo you can just hijack, but you can easily make one by extending the MODx.combo.ComboBox object, and pointing it to a processor of your own that fetches the resources you want to be able of picking from.

          If you want it as a TV, do use resourcelist, as it has plenty of configuration options for you to filter on: http://markh.nl/s/04/y1n.png
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 37743
            • 49 Posts
            No filtering options but here's a basic outline i got working (i think it will need a custom processor to filter the results?)
            MODx.combo.Resource = function(config){
                config = config || {};
                Ext.applyIf(config,{
                    id: 'modx-combo-resource' 
            		,name: 'resourceID'
            		,hiddenName: 'resourceID'
                    ,displayField: 'pagetitle'
                    ,valueField: 'id'
            		,mode: 'remote'
            		,fields: ['id','pagetitle']
            		,forceSelection: true
            		,editable: false
                    ,enableKeyEvents: true
            		,pageSize: 20
                    ,url: MODx.config.connectors_url+'resource/index.php'
                    ,baseParams: { 
            			 action: 'getList'
            			,showNone: true
            		}         
                });
                MODx.combo.Resource.superclass.constructor.call(this, config);
            };
            Ext.extend(MODx.combo.Resource,MODx.combo.ComboBox);
            Ext.reg('modx-combo-resource',MODx.combo.Resource);
            
            [ed. note: alanpich last edited this post 14 years, 5 months ago.]