Results 1 to 2 of 2

Thread: How to disable/enable cell editing based on the value selected in a combobox?

  1. #1

    Default How to disable/enable cell editing based on the value selected in a combobox?


    I want to disable/enable cells according to the value in the which is selected in the combobox in the same row.
    I am using a listener to get the value of the combobox..but not able to figure out how to use that value to disable/enable the other cells in the same row.

    Please give an idea.

    This is my grid panel
     this.columns = [      
    									header : 'Abc',
    									sortable : true,
    									dataIndex : 'abcDesc',
    									displayField : 'description',
    									grid : me
    {header: " Comments", dataIndex: 'Comments'},
    		    {header: "Days", dataIndex: 'Days'}
     abcDropdownColumn : function(config) {
    		return {
    			header : config.header,
    			//width : config.width,
    			dataIndex : config.dataIndex,
    			editor : {
    				xtype : 'combo',
    				id: 'rightsCombo',
    				editable : true,
    				allowBlank : false,
    				queryMode : 'remote',
    				typeAhead : true,
    				//hideTrigger : true,
    				store : 'Store',
    				displayField : 'abcDesc',
    				valueField : 'abcDesc',
    				triggerAction : 'all',
    				forceSelection : true,
    				listConfig : {
    					loadingText : 'Searching...',
    					emptyText : 'No matching abc...'
    				grid: config.grid,
    		        displayFieldUpdateTarget: config.displayField,
    				  listeners: {
    			          select: function(combo, records, opts) {
    			            if (records.length > 0) {
    			              var record = this.grid.getStore().getAt(this.grid.getSelectionModel().position.row);
    			             if(records[0].data.commonProperty == " Exhibition"){
    			            	//need to put the condition here so as to make the "comment" cell and "days" cell    editable

  2. #2
    Sencha User
    Join Date
    Aug 2008
    Brasov, Romania


    I would try a different approach:
    Implement the enable /disable rule in the beforeEdit method of the cell editor which you provide to your grid (Ext.grid.plugin.CellEditing) The comboBox returns the value in the record of the current row and when you want to start editing another cell check if the editing is allowed

    beforeEdit : function(context) {
    if (context.field == "
    " && context.record.get("
    ") == "xxx" ) {
    return false;

    Check the docs to see what else is available in the context parameter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts