1. #1
    Sencha User LoriSun's Avatar
    Join Date
    Jan 2009
    Location
    China, Dalian
    Posts
    31
    Vote Rating
    1
    LoriSun is on a distinguished road

      0  

    Question Unanswered: Can we hide checkbox(via CheckBoxCell) for special rows in the grid with InlineEdr?

    Unanswered: Can we hide checkbox(via CheckBoxCell) for special rows in the grid with InlineEdr?


    Hi Dev,

    Can we hide the special row's checkbox for grid which has one column with CheckBoxCell?
    I have tried with the approach: cell.removeFromParent(), it works at the initial time, but my grid also has inline editing feature, after the editing.onCompleteEdit(....) , the checkbox of the current editing row was back again.

    Do you guys have any good approach? Could you please share.

    Thanks in advance
    Lori
    Last edited by LoriSun; 18 Mar 2012 at 7:36 PM. Reason: Adjusted format
    Sencha fans

  2. #2
    Sencha User LoriSun's Avatar
    Join Date
    Jan 2009
    Location
    China, Dalian
    Posts
    31
    Vote Rating
    1
    LoriSun is on a distinguished road

      0  

    Lightbulb


    Hi support,

    Could you please advise? or GXT doesn't have such feature now.....

    Thanks,
    Lori
    Sencha fans

  3. #3
    Sencha User LoriSun's Avatar
    Join Date
    Jan 2009
    Location
    China, Dalian
    Posts
    31
    Vote Rating
    1
    LoriSun is on a distinguished road

      0  

    Default


    Hi Guys,

    I got a strange approach, use the value of CheckBoxCell column( true -> checked; false -> unchecked; null -> hidden )
    it really works for me. share as below:

    We need 2 classes modified.

    1,) CheckBoxDefaultAppearance4Hidden :
    Code:
    public class CheckBoxDefaultAppearance4Hidden extends CheckBoxDefaultAppearance {
    
        @Override
        public void render( SafeHtmlBuilder sb, Boolean value, CheckBoxCellOptions options ) {
            String name = options.getName() != null ? " name='" + options.getName() + "' " : "";
            String disabled = options.isDisabled() ? " disabled=true" : "";
            String ro = options.isReadonly() ? " readonly" : "";
            String id = " id=" + XDOM.getUniqueId();
            String t = " type=" + type;
            sb.appendHtmlConstant( "<div class=" + style.wrap() + ">" );
            if ( value != null ) {
                String checked = value ? " checked" : "";
                sb.appendHtmlConstant( "<input " + t + name + disabled + ro + id + checked + "/>" );
            }else {
                sb.appendHtmlConstant( "<span " + name  + id  + "/>" );
            }
            sb.appendHtmlConstant( "<label for=" + id + " htmlFor=" + id + " class=" + style.checkBoxLabel() + ">" );
            if ( options.getBoxLabel() != null ) {
                sb.appendHtmlConstant( options.getBoxLabel() );
            }
            sb.appendHtmlConstant( "</label>" );
    
        }
    }
    2,) CheckBoxCell4Hidden :
    Code:
    public class CheckBoxCell4Hidden extends CheckBoxCell {
    
        public CheckBoxCell4Hidden( CheckBoxAppearance appearance ) {
            super( appearance );
        }
    
        @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() );
    
            //appearance.render(sb, value == null ? false : value, opts);
            //pass 'null' as a validated value 
            appearance.render( sb, value, opts );
        }
    }
    Useage:
    Code:
    private final ColumnConfig<PreNameValue4Gride, Boolean>    cc2  = new ColumnConfig<PreNameValue4Gride, Boolean>(roperties.willBeDeleted(),35, "" );
    
    CheckBoxCell cbc = new CheckBoxCell4Hidden( new CheckBoxDefaultAppearance4Hidden() );
    
    cc2.setCell( cbc );
    If any formal /good approach, please let me know.

    Thanks,
    Lori
    Last edited by LoriSun; 20 Mar 2012 at 12:23 AM. Reason: Modify piece of code, otherwise will throw javascript exception when click the row..
    Sencha fans

  4. #4
    Sencha User
    Join Date
    Jun 2012
    Posts
    1
    Vote Rating
    0
    mtduit is on a distinguished road

      0  

    Default Diable CheckBox in grid with special index

    Diable CheckBox in grid with special index


    Code:
    Hi. You can try codes:
        getDisplay().getGridConfig().getView()
                                        .getCell(3, 0).<XElement> cast()
                                        .selectNode("input")
                                        .setAttribute("disabled", "disabled");

Thread Participants: 1

Tags for this Thread