View Full Version : Dynamic field handling in a Grid column.

8 Oct 2012, 5:44 AM
I am somewhat new to ext js and have adopted a code base on a project I need to maintain going forward. The system uses Ext Js to make a editable spreadsheet of data records. I am currently trying to make an update which I have hit a dead end at. Lets take an example. I have a column for a status type. Options are New, In-progress, Complete. If the status on the record is not "Complete" when the user clicks on the cell it should give them a select list of the two options New or In-Progress. Certain other events that manipulate the data will change the record to status complete. When this occurs, if the cell is displaying the status 'complete' it will not be editable.

My issue is I can only seem to do one or the other. I can make the column support the cells to be select lists or I can make the column un-editable. I cannot figure out how to handle each cell in its own way based on its value. Here is what the parts of the code would look like. (The actual code is jumbled into a lot of dynamically written files, and I unfortunately cant share those.)

Field Definition...

var status_store = Ext.create('Ext.data.Store', {
fields: ['text', 'value', 'ct'],
data: [
{ 'text': 'New', 'value': 'New' },
{ 'text': 'In-Progress', 'value': 'In-Progress' }

var status_field = {
xtype: 'combobox',
selectOnTab: true,
lazyRender: true,
store: status_store,
displayField: 'text',
valueField: 'value',
forceSelection: true

Column Definition...

var row_columns = [{
text: 'Fields',
locked: true,
hideable: false,
sortable: false,
width: 400,
columns: [{

text: 'Status',
hideable: false,
width: 100,
dataIndex: 'status',
field: status_field,
sortable: true


I have found that using the code this way will use the select list for every cell in the column. If i remove the field property on the column definition it just renders the value statically. I want a way to detect if the value of the cell will be "Complete" and if it is remove the reference to the select list field definition.

Is this possible? Or should I be attempting this in a completely different way.


10 Oct 2012, 9:33 AM
Have you tried returning false in the beforeedit event on the grid panel? That should prevent editing