1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    17
    Vote Rating
    0
    Kathie is on a distinguished road

      0  

    Default Checkbox grid - disable checkbox

    Checkbox grid - disable checkbox


    Is it possible to disable a checkbox in a checkbox grid? Or simply just not to display it?

  2. #2
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    Are you talking about the column used for selection?

    If so, we've had various discussions around this in the forums and while it may be possible to do this, it's not going to be easy. Usually the answer was to inquire about the specific functionality the user ultimately wanted to accomplish (beyond the disabling bit) and see if they were going about it the right way.

    E.g., if you don't want the user to be able to select something, perhaps a selection grid is not the best solution to adopt.

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    http://www.sencha.com/forum/showthread.php?244003 is another thread that touchs on this.

    The important detail is a ColumnConfig has a Cell, and that Cell describes how to draw the contents. If there is no Cell, the object in that grid cell will have toString() invoked on it, and that will be added to the contents.

    A custom Cell like GXT's CheckBoxCell or GWT's CheckboxCell could be extended to not draw under certain conditions, but you'd need to have some way of passing that additional state (not true or false but invisible, or true and invisible or false and invisible) in to the cell. The CheckBoxSelectionModel has its own cell that it uses to render, which draws different images to get the right effect - that leans on the selected styles that the grid sets to rows that have been activated.

    In any case, you'll need a custom Cell (or more likely AbstractCell) for custom drawing behavior. If you can outline what you are trying to achieve, it will be easier to suggest the right course of action.

  4. #4
    Sencha Premium Member
    Join Date
    Jun 2013
    Location
    Nuremberg, Germany
    Posts
    61
    Vote Rating
    1
    Holger Herrmann is on a distinguished road

      0  

    Default


    Finally I was facing the same problem. To share the solution I made, here is the custom class of CheckBox I have created:

    Code:
    import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
    import com.sencha.gxt.cell.core.client.form.CheckBoxCell;
    
    public class MyCheckBoxCell extends CheckBoxCell {
    
        private boolean enabled = true;
        
        public MyCheckBoxCell(boolean enabled) {
            super();
            this.enabled = enabled;
        }
        
        @Override
        public void render(com.google.gwt.cell.client.Cell.Context context, Boolean value, SafeHtmlBuilder sb) {
            CheckBoxCellOptions opts = new CheckBoxCellOptions();
    
            opts.setName(name);
    
            opts.setReadonly(isReadOnly());
            opts.setDisabled(isDisabled());
            opts.setBoxLabel(getBoxLabel());
            opts.setDisabled(!enabled);
    
            appearance.render(sb, value == null ? false : value, opts);
        }
    
        public boolean isEnabled() {
            return enabled;
        }
    
        public void setEnabled(boolean enabled) {
            this.enabled = enabled;
        }
    }
    This Cell is added when the ColumnConfig is created:

    Code:
        private static MyColumnConfig<BomObject, Boolean> generateCheckBoxColumnConfig(HeaderColumn column,
                BomPropertyAccess bomPropertyAccess, boolean sortable, boolean selectableColumns) {
    
            MyColumnConfig<BomObject, Boolean> columnConfig = getBooleanColumnConfigByBomElement(column.getBomElementName(), bomPropertyAccess);
    
            if (columnConfig != null) {
                columnConfig.setCell(new MyCheckBoxCell(column.isEnabled()));
                columnConfig.setHeader(column.getHeaderColumn());
                columnConfig.setWidth(column.getWidth());
                columnConfig.setSortable(sortable);
            }
    
            return columnConfig;
        }
    Best,
    Holger

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..."