简体   繁体   English

如何从GXT 2.2.3迁移到GXT 3.0.1

[英]How to migrate from GXT 2.2.3 to GXT 3.0.1

I created EditorGrid using GXT 2.2.3.Everything required is over.But at one point I stucked ie I need to disable and enable some cells based on the value in one cell.I asked Question for this How to make cell as non editable based on another cell value in Editable Grid in gxt . 我使用GXT 2.2.3创建了EditorGrid,但所需的一切都结束了,但是我一度陷入困境,即我需要基于一个单元格中的值禁用和启用某些单元格。我问这个问题如何使单元格成为不可编辑的在gxt中可编辑网格中的另一个单元格值上 But I got the solution that doesn't working for me.I asked in Sencha,coderanch and some other forums,but still I didn't got solution. 但是我得到了对我不起作用的解决方案。我在Sencha,coderanch和其他一些论坛上问过,但仍然没有解决方案。

Now I decided to migrate this to GXT 3.0.1. 现在,我决定将其迁移到GXT 3.0.1。

I need an EditableGrid and need to disable and enable the cell editing based on the value in another Cell.Please suggest which grid is suitable for this in GXT 3.0.1 and how to migrate to GXT 2.2.3 to GXT 3.0.1. 我需要一个EditableGrid并需要基于另一个单元格中的值禁用和启用单元格编辑。请建议在GXT 3.0.1中哪个网格适用于此,以及如何迁移到GXT 2.2.3到GXT 3.0.1。

I dont work with gxt 2.xx My friend trys to migrate from 2 to 3. And he use 2 and 3 parallel. 我不使用gxt 2.xx,我的朋友尝试从2迁移到3。他使用2和3并行。 So he start to build a new pages with gxt3 because if youll mix them you may have a big problems with layouts! 因此,他开始使用gxt3构建新页面,因为如果您将它们混合在一起,则布局可能会遇到很大的问题! If you want to use gxt3 you should do sonething like this: 如果要使用gxt3,则应执行以下操作:

//Create grid
Grid<Plant> grid = new Grid(...);
//Create editable grid
GridEditing<Plant> editing = new GridInlineEditing<Plant>(editableGrid);

//add first editing column
TextField watchField = new TextField();
TextField targerField = new TextField();

watchField.addChangeHandler(new ChangeHandler() {
   @Override
   public void onChange(ChangeEvent event) {
      if(smtng) targerField.disable();
      else targetField.enable();
   }
}); 
editing.addEditor(cc1, watchField);
editing.addEditor(cc2, targetField);

So I think thats help you. 所以我认为那对您有帮助。

I resolved this by just using CSS. 我仅使用CSS即可解决此问题。 Instead thinking of disabling and enabling the cell, I just hide and show the cell using CSS. 与其考虑禁用和启用该单元,不如使用CSS隐藏和显示该单元。 Below is my code which saves me to reach this requirement. 下面是我的代码,可以节省我一些时间。

 GridCellRenderer<AttendanceCaseCreationModel> checkinRenderer=new GridCellRenderer<AttendanceCaseCreationModel>() {

        @Override
        public Object render(AttendanceCaseCreationModel model, String property,
                ColumnData config, int rowIndex, int colIndex,
                ListStore<AttendanceCaseCreationModel> store,
                Grid<AttendanceCaseCreationModel> 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;

        }
    };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM