Results 1 to 8 of 8

Thread: [SOLVED] enable/disable textfield when item combobox is selected

  1. #1

    Default [SOLVED] enable/disable textfield when item combobox is selected

    I use an Ext.ux.grid.RowEditor plugin in a gridpanel. I put two columns in the grid panel a combobox and a textfield. I need to set enable / disable the textfield when I select an item from combo box. this is my code. thank you regards.
    Code:
    //roweditor definition
    var editor = new Ext.ux.grid.RowEditor({
    saveText: 'Grabar'
    });
     
    //gridpanel definition
    var grid = new Ext.grid.GridPanel({
    renderTo: document.body,
    enablecolumnmove:true,
    title: 'Informacion',
    store: dsgrid,
    frame:true,
    height:200,
    width:1000,
    region:'center',
    plugins: [editor],
    tbar: [{
    text: 'Agregar Registro',
    handler: function(){
    var e = new dr_grid({
    type:'',
    concepto:''});
    editor.stopEditing();
    dsgrid.insert(0, e);
    grid.getView().refresh();
    grid.getSelectionModel().selectRow(0);
    editor.startEditing(0);
    }
    },{ text: 'Remover registro',
    disabled: true,
    handler: function(){
    editor.stopEditing();
    var s = grid.getSelectionModel().getSelections();
    for(var i = 0, r; r = s[i]; i++){
    dsgrid.remove(r);
    }
    }
    }],
    columns: [{header: "Type", dataIndex: 'type',editor: cmbtype, renderer:cmbtype(cmbtype)},
    {header: "concepto", dataIndex: 'concepto', editor: concepto}]
    });
     
    //this is de event select
    cmbtype.on ('select',function(){
     
    if (Ext.util.Format.uppercase(tipo)=='JURIDICA')
    {
    concepto.disabled=true; //this is the problem, without error but doesn't work.
    }
    else
    {
    concepto.disabled=false;
    }
     
     
    });
     
      












    Last edited by jimmyful; 5 Jul 2010 at 8:07 AM. Reason: solved

  2. #2
    Ext JS Premium Member prophet's Avatar
    Join Date
    Mar 2007
    Location
    Greenwich, CT
    Posts
    189

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    isCellEditable won't work on a RowEditor.

    The problem with your code is that your are changing the read-only property 'disabled'. You should be using the setDisabled method intead.

  4. #4
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    Please post code within [ CODE ] tags in the future.

  5. #5

    Default

    Thank you, setDisabled works fine.
    Code:
     
    if (Ext.util.Format.uppercase(tipo)=='JURIDICA')
    {
    concepto.setDisabled(true);
    }
    else
    {
    concepto.setDisabled(false);
    }

  6. #6
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    you have to close the code tag [ /code ]

  7. #7
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    And you can simplify your code by doing:
    Code:
    concepto.setDisabled(Ext.util.Format.uppercase(tipo) === 'JURIDICA');

  8. #8

    Default

    Thanks a lot.

Similar Threads

  1. Enable/disable button on rows selected?
    By moegal in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 16 Jul 2009, 9:30 AM
  2. combobox disable enable
    By frknml in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 14 Feb 2009, 1:25 PM
  3. Button enable/disable based on Textfield data entry
    By mthad in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 30 Jun 2008, 12:31 PM
  4. Enable/Disable ComboBox on editorGrid
    By cooldude87801 in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 26 Mar 2008, 3:58 PM
  5. loading 2nd combobox depending on the item selected in 1st combobox
    By basavarajkoti in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 7 Jan 2008, 5:20 AM

Tags for this Thread

Posting Permissions

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