1. #1
    Ext User
    Join Date
    Jan 2009
    Posts
    7
    Vote Rating
    0
    Brad2009 is on a distinguished road

      0  

    Default Checkbox enable/disable

    Checkbox enable/disable


    I have Combobox and Checkbox in the grid.
    How can I disable / enable Checkbox based on the values selected in combobox?

    For example, Combobox value has the following values {1,2,3,4}
    If combobox value is 1 or 3 then checkbox should be disabled.

    Thanks in advance

  2. #2
    Sencha User
    Join Date
    Nov 2007
    Posts
    135
    Vote Rating
    0
    new2ext is on a distinguished road

      0  

    Default


    Use the select() event to fire the checkbox's enable/disable function.

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    No, that is not the proper method.

    Normally you implement the isCellEditable method of the ColumnModel and return false for the checkbox field if the combobox field contains a value 1 or 3.

    Unfortunately CheckboxColumn doesn't check isCellEditable (it's a bug, you can probably find a fix somewhere on this forum...).

  4. #4
    Ext User
    Join Date
    Jan 2009
    Posts
    7
    Vote Rating
    0
    Brad2009 is on a distinguished road

      0  

    Default Check box problem

    Check box problem


    When I use isCelleditable it is making read only entire row not a particualr cell
    Is there any way to hide particular check boxes in grid?

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You wrote the isCellEditable method wrong if the whole row becomes uneditable!

    ps. Are you using a CheckboxSelectionModel or a CheckColumn?

  6. #6
    Ext User
    Join Date
    Jan 2009
    Posts
    7
    Vote Rating
    0
    Brad2009 is on a distinguished road

      0  

    Default Check box problem

    Check box problem


    Thanks Condor,

    I am using "CheckboxSelectionModel "

    ------------------------------------------------------
    ------------------------------------------------------

    var checkboxEditor = {
    header: 'Test',

    dataIndex: 'testbox',
    renderer: function(v) {
    return '<div class="x-grid3-check-col'+(v?'-on':'')+'">*</div>';
    },
    editor: new Ext.grid.GridEditor(new Ext.form.Checkbox(), {
    cls: 'x-small-editor x-grid-editor grid-checkbox-editor'
    })
    }
    --------------------------------------------------------
    ---------------------------------------------------------

  7. #7
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Which is it? Are you using a CheckboxSelectionModel or the checkboxEditor column config you supplied?

    You can fix the second one with:
    Code:
    var checkboxEditor = {
        header: 'Test',
        dataIndex: 'testbox',
        renderer: function(v, meta, r, row, col) {
            if(!colModel.isCellEditable(col, row)){
              return '& #160;';
            }
            return '<div class="x-grid3-check-col'+(v?'-on':'')+'">*</div>';
        },
        editor: new Ext.grid.GridEditor(new Ext.form.Checkbox(), {
            cls: 'x-small-editor x-grid-editor grid-checkbox-editor'
        })
    }
    (remove space between & and #160

  8. #8
    Ext User
    Join Date
    Jan 2009
    Posts
    7
    Vote Rating
    0
    Brad2009 is on a distinguished road

      0  

    Default Check box problem

    Check box problem


    I am using checkboxEditor column.
    "Colindex 12" is my checkboxEditor column
    --------------------------------------------------

    isCellEditable : function(colIndex, rowIndex)
    {
    if (combobox1.getvalue() = 1))

    {this.config[12].editable = true;}
    else
    {this.config[12].editable = false;}
    return (this.config[12].editable )

    -------------------------------------------------------------------------
    Could you advise on that?
    Tnx for your quick reply

  9. #9
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    That is not the way to use isCellEditable.

    Try:
    Code:
    isCellEditable: function(colIndex, rowIndex){
    	var dataIndex = this.getDataIndex(colIndex);
    	if(dataIndex == 'testbox'){
    		var r = store.getAt(rowIndex);
    		return r.get('dataIndex-of-column-with-combobox') == 1;
    	}
    	return this.constructor.prototype.isCellEditable.apply(this, arguments);
    }

  10. #10
    Ext User
    Join Date
    Jan 2009
    Posts
    7
    Vote Rating
    0
    Brad2009 is on a distinguished road

      0  

    Default Check column

    Check column


    Hi Condor, It is not working. Should I use checkcolumn instead?

    I have 2 coumns in the grid.
    The first columns is COMBObox column called CB1
    The second one is checkbox Editor column.
    CB1 contains the following value. ('Rec1','Rec2','Rec3','Rec4')
    If CB1='Rec1' or CB1='Rec2' ,then checkbox editor column should be invisible.
    Otherwise checkbox editor column should be visible.

    Could you advise?

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi