gxt网格中的条件编辑

时间:2014-12-03 10:49:03

标签: gxt

我有一个可编辑的gxt树网格,现在问题是只有某些行必须是可编辑的。 经过一番风光,我能够找到这些东西。我正在使用内联编辑器

editing.addBeforeStartEditHandler(new BeforeStartEditHandler<RevenueGrossBean>() {

            @Override
            public void onBeforeStartEdit(
                    BeforeStartEditEvent<RevenueGrossBean> event) {

                                                    //how to acess the model bean that is about to be edited
                                               //hw to prevent the edit action from completion

            }
        });

有没有办法实现这个目标?

1 个答案:

答案 0 :(得分:1)

可以使用选择模型

来实现
 editing.addBeforeStartEditHandler(new BeforeStartEditHandler<RevenueGrossBean>() {

                @Override
                public void onBeforeStartEdit(
                        BeforeStartEditEvent<RevenueGrossBean> event) {

            //how to acess the model bean that is about to be edited
           RevenueGrossBean bean = event.getSource().getEditableGrid()
                        .getSelectionModel().getSelectedItem();
           //hw to prevent the edit action from completion
           event.setCancelled(true);



                }
            });