How to make cell as non editable based on another cell value in Editable Grid in gxt

后端 未结 3 1730
不知归路
不知归路 2020-12-21 05:54

Hi I am creating Editable Grid using GXT 2.2.3. I created columns like below:

   List eventList=new ArrayList();
    eventList.ad         


        
3条回答
  •  半阙折子戏
    2020-12-21 07:00

    Instead thinking of disabling and enabling the cell, I just hide and show the cell using CSS. Below is my code which saves me to reach this requirement.

    GridCellRenderer checkinRenderer=new GridCellRenderer() {
    
            @Override
            public Object render(AttendanceCaseCreationModel model, String property,
                    ColumnData config, int rowIndex, int colIndex,
                    ListStore store,
                    Grid grid) {
    
                String color="pink";
                if(eventcombo.getValue()!=null){
    
    
                    if(eventcombo.getRawValue().equalsIgnoreCase("Forgot To Checkin") || 
                            eventcombo.getRawValue().equalsIgnoreCase("Mark/Modify Attendance")){
                        color="pink";
                    }
                    else{
    
                        config.style=config.style+ ";visibility: hidden;";
                    }
    
                }
    
                config.style=config.style+ ";background-color:" + color  + ";";
                config.style=config.style+ ";display: block;";
                Object value = model.get(property);
                return value;
    
            }
        };
    

提交回复
热议问题