<p>I have an ext combobox which uses a store to suggest values to a user as they type. </p>

<p>An example of which can be found here: <a href="http://extjs.com/deploy/ext/examples/form/combos.html" rel="nofollow noreferrer">combobox example</a></p>

<p>Is there a way of making it so the <strong>suggested text list</strong> is rendered to an element in the DOM. Please note I do not mean the "applyTo" config option, as this would render the whole control, including the textbox to the DOM element.</p>

[{'answer_id': 74680, 'author': 'noah', 'author_id': 12034, 'author_profile': 'https://Stackoverflow.com/users/12034', 'pm_score': 0, 'selected': False, 'text': '<p>So clarify, you want the selected text to render somewhere besides directly below the text input. Correct?</p>\n\n<p>ComboBox is just a composite of <a href="http://extjs.com/deploy/dev/docs/?class=Ext.DataView" rel="nofollow noreferrer">Ext.DataView</a>, a text input, and an optional trigger button. There isn\'t an official option for what you want and hacking it to make it do what you want would be really painful. So, the easiest course of action (other than finding and using some other library with a component that does exactly what you want) is to build your own with the components above:</p>\n\n<ol>\n<li>Create a text box. You can use an <a href="http://extjs.com/deploy/dev/docs/?class=Ext.form.TextField" rel="nofollow noreferrer">Ext.form.TextField</a> if you want, and observe the keyup event.</li>\n<li>Create a DataView bound to your store, rendering to whatever DOM element you want. Depending on what you want, listen to the \'selectionchange\' event and take whatever action you need to in response to the selection. e.g., setValue on an Ext.form.Hidden (or plain HTML input type="hidden" element).</li>\n<li>In your keyup event listener, call the store\'s filter method (see <a href="http://extjs.com/deploy/dev/docs/?class=Ext.data.Store" rel="nofollow noreferrer">doc</a>), passing the field name and the value from the text field. e.g., store.filter(\'name\',new RegEx(value+\'.*\'))</li>\n</ol>\n\n<p>It\'s a little more work, but it\'s a lot shorter than writing your own component from scratch or hacking the ComboBox to behave like you want.</p>\n'}, {'answer_id': 75619, 'author': 'Thevs', 'author_id': 8559, 'author_profile': 'https://Stackoverflow.com/users/8559', 'pm_score': 2, 'selected': True, 'text': "<p>You can use plugin for this, since you can call or even override private methods from within the plugin:</p>\n\n<pre><code>var suggested_text_plugin = {\n\n    init: function(o) {\n\n        o.onTypeAhead = function() {\n            // Original code from the sources goes here:\n\n            if(this.store.getCount() &gt; 0){\n                var r = this.store.getAt(0);\n                var newValue = r.data[this.displayField];\n                var len = newValue.length;\n                var selStart = this.getRawValue().length;\n                if(selStart != len){\n                    this.setRawValue(newValue);\n                    this.selectText(selStart, newValue.length);\n                }\n            }\n\n         // Your code to display newValue in DOM\n         ......myDom.getEl().update(newValue);\n        };\n    }\n};\n\n\n// in combobox code:\n\nvar cb = new Ext.form.ComboBox({\n    ....\n    plugins: suggested_text_plugin,\n    ....\n});\n</code></pre>\n\n<p>I think it's even possible to create a whole chain of methods, calling original method before or after yours, but I haven't tried this yet.</p>\n\n<p>Also, please don't push me hard for using non-standard plugin definition and invocation methodics (undocumented). It's just my way of seeing things.</p>\n\n<p>EDIT:</p>\n\n<p>I think the method chain could be implemented something like that (untested):</p>\n\n<pre><code>....\no.origTypeAhead = new Function(this.onTypeAhead.toSource());\n// or just\no.origTypeAhead = this.onTypeAhead;\n....\n\no.onTypeAhead = function() {\n    // Call original\n    this.origTypeAhead();\n    // Display value into your DOM element\n    ...myDom....\n};\n</code></pre>\n"}, {'answer_id': 81766, 'author': 'Chris James', 'author_id': 3193, 'author_profile': 'https://Stackoverflow.com/users/3193', 'pm_score': 0, 'selected': False, 'text': '<p>@Thevs</p>\n\n<p>I think you were on the right track. </p>\n\n<p>What I did was override the initList method of Combobox.</p>\n\n<pre><code>    Ext.override(Ext.form.ComboBox, {\n    initList : function(){\n</code></pre>\n\n<p>If you look at the code you can see the bit where it renders the list of suggestions to a dataview. So just set the apply to the dom element you want:</p>\n\n<pre><code>            this.view = new Ext.DataView({\n            //applyTo: this.innerList,\n            applyTo: "contentbox",\n</code></pre>\n'}, {'answer_id': 83721, 'author': 'Thevs', 'author_id': 8559, 'author_profile': 'https://Stackoverflow.com/users/8559', 'pm_score': 0, 'selected': False, 'text': "<p>@qui</p>\n\n<p>Ok. I thought you want an extra DOM field (in addition to existing combo field).</p>\n\n<p>But your solution would override a method in the ComboBox class, isn't it? That would lead to all your combo-boxes would render to the same DOM. Using a plugin would override only one particular instance.</p>\n"}, {'answer_id': 85687, 'author': 'noah', 'author_id': 12034, 'author_profile': 'https://Stackoverflow.com/users/12034', 'pm_score': 1, 'selected': False, 'text': "<p>@qui</p>\n\n<p>Another thing to consider is that initList is not part of the API. That method could disappear or the behavior could change significantly in future releases of Ext. If you never plan on upgrading, then you don't need to worry.</p>\n"}]
['https://Stackoverflow.com/questions/74266', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3193/']