Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to populate Ext.js 4 grid panel cell after selecting item from autocomplete?
    primarykey
    data
    text
    <p>I am a bit uncertain about how to do the following:</p> <p>I've got a grid panel and on one of the fields, I've got an autocomplete and this part of my application is working fine. </p> <p><img src="https://i.stack.imgur.com/YCNKW.png" alt="Autocomplete in gridpanel"></p> <p>What I would like to do is this: Upon selecting an item from the autocomplete list, I will like to populate the "Description" data associated with that item and populate it in the appropriate cell. </p> <p>For instance , the data returned for "PartNum 3" is:</p> <pre class="lang-js prettyprint-override"><code>{"PartNum":"PartNum 3","Description":"Description partnum 3"} </code></pre> <p>Upon selection I'd like "Description partnum 3" to be updated in the "Description" cell of the grid panel. </p> <p>Now, what I'm a bit confused about is what is the best way to do this. The first way seems to be a "DOM" model as explained here <a href="https://stackoverflow.com/questions/2447401/how-to-read-and-set-a-value-of-a-specific-cell-in-an-extjs-grid">How to read and set a value of a specific cell in an ExtJS Grid?</a>. The other method appears to be more of "Store" solution e.g. <a href="https://stackoverflow.com/questions/4218075/update-or-reload-store-of-extjs-combobox">Update or Reload Store of ExtJs ComboBox</a></p> <p>So my question is which method should I be using and why? In particular, I would like to know what the best way would be when performing an add operation in the backend. </p> <p>Some code for the "Store" method as it applies to the Gridpanel and autocomplete would be very welcome as well. </p> <p>As far as the current code is concerned, here is my model:</p> <pre class="lang-js prettyprint-override"><code>Ext.define('CustomerOrderLineGrid.model.COLInventoryPart', { extend: 'Ext.data.Model' , fields: ['Id', 'PartNum', 'Description'] , proxy: { type: 'ajax' , api: { read: '../InventoryPart/InventoryPartListAutoComplete' } // , url: 'someUrl' , extraParams: { total: 50000 } , reader: { type: 'json' , root: 'InventoryParts' , successProperty: 'success' , totalProperty: 'total' } , simpleSortMode: true } </code></pre> <p>});</p> <p>The store is:</p> <pre class="lang-js prettyprint-override"><code>Ext.define('CustomerOrderLineGrid.store.COLInventoryParts', { extend: 'Ext.data.Store', model: 'CustomerOrderLineGrid.model.COLInventoryPart', autoLoad: false , pageSize: 200 , remoteSort: true , remoteFilter: true , buffered: true , sorters: [{ property: 'PartNum' , direction: 'ASC' }] </code></pre> <p>});</p> <p>and part of the view is:</p> <pre class="lang-js prettyprint-override"><code>, editor: { xtype: 'combo' , store: 'COLInventoryParts' , displayField: 'PartNum' , typeAhead: true , width: 320 , hideTrigger: true , minChars: 2 , listeners: { select: function (f, r, i) { // CODE TO INSERT TO POPULATE DESCRIPTION FIELD } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload