Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is the solution I came up with.</p> <ol> <li><p>In my column model, I made sure that the column I am making "editable" has an id. Each cell in that column will now have a CSS class associated with it named "x-grid-col-{id}". My column id is "status" so the class was "x-grid-col-status".</p></li> <li><p>I created the CSS for class "x-grid-col-status" which sets the dropdown arrow image as the background, aligned right. It also sets the cursor to pointer, so the user knows they can click on the cell.</p> <pre><code>.x-grid3-col-status { background-image: url(Image/trigger-single.gif); background-position: right; background-repeat: no-repeat; cursor: pointer; } </code></pre></li> <li><p>Next, I set up a listener for my ComboBox that listens for the 'focus' event. On focus, I expand the drop down. It is important that I had to add lazyInit: false to my ComboBox config, or else an empty list will appear when you expand. <em>lazyInit - true to not initialize the list for this combo until the field is focused (defaults to true)</em></p></li> </ol> <p>The code:</p> <pre><code> Ext.util.Format.comboRenderer = function (combo) { return function (value, metaData, record, rowIndex, colIndex, store) { var record = combo.findRecord(combo.valueField, value); return record ? record.get(combo.displayField) : combo.valueNotFoundText; } } var combo = new Ext.form.ComboBox({ typeAhead: true, triggerAction: 'all', lazyInit: false, lazyRender: true, mode: 'local', editable: false, store: new Ext.data.ArrayStore({ id: 0, fields: [ 'statusId', 'displayText' ], data: data }), valueField: 'statusId', displayField: 'displayText', listeners: { 'focus': { fn: function (comboField) { comboField.doQuery(comboField.allQuery, true); comboField.expand(); } , scope: this } , 'select': { fn: function (comboField, record, index) { comboField.fireEvent('blur'); } , scope: this } } }); var cm = new Ext.grid.ColumnModel({ defaults: { sortable: true }, columns: [ { id: 'orderId', header: 'ID', dataIndex: 'id', width: 50 }, { header: 'Status', id: 'status', dataIndex: 'status', width: comboColumnWidth, editor: combo, renderer: Ext.util.Format.comboRenderer(combo) }, { id: 'orderSummary', header: 'Summary', dataIndex: 'summary', renderer: this.renderSummary } ] }); var orderGrid = new Ext.grid.EditorGridPanel({ store: this.getOrderStore(), cm: cm, autoExpandColumn: 'orderSummary', title: title, clicksToEdit: 1 }); </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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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