如何通过单击单元格表中的单元格来打开弹出面板?

发布于 2025-01-08 13:24:13 字数 731 浏览 0 评论 0原文

我有一个 CellTable 显示如下所示 -在此处输入图像描述

单击“删除”按钮时我想打开一个弹出窗口屏幕中央的面板,其中应包含一个流程面板和一个按钮。
现在,对于“删除”按钮,我有以下功能 -

deleteColumn.setFieldUpdater(new FieldUpdater<Contact, String>() {
        public void update(int index, Contact object, String value) {           
            try {
                int removeIndex = CONTACTS.indexOf(object);
                CONTACTS.remove(removeIndex);

                table.setRowCount(CONTACTS.size(), true);
                table.setRowData(CONTACTS);

                table.redraw();

            } catch(Exception e) {
                e.printStackTrace();
            }});

我不明白如何更新我的功能。示例代码肯定会有所帮助。

I have a CellTable being displayed like shown below-enter image description here

On click of the Delete button I want to open a Popup panel in the center of the screen which should contain a Flow Panel and a Button within it.
Right now for the Delete button I have the following function-

deleteColumn.setFieldUpdater(new FieldUpdater<Contact, String>() {
        public void update(int index, Contact object, String value) {           
            try {
                int removeIndex = CONTACTS.indexOf(object);
                CONTACTS.remove(removeIndex);

                table.setRowCount(CONTACTS.size(), true);
                table.setRowData(CONTACTS);

                table.redraw();

            } catch(Exception e) {
                e.printStackTrace();
            }});

I do not understand how to update my function for the same. A sample code will surely help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒绊 2025-01-15 13:24:13

只显示一个 PopupPanel 怎么样?

像这样的事情:

PopupPanel popup = new PopupPanel(true);
FlowPanel panel = new FlowPanel();
//add Button etc
popup.setSize("1100px","500px");
popup.clear();
popup.add(panel);
popup.show();
popup.center();

如果你想显示一个确认对话框,那么这段代码更容易:

if (Window.confirm("Do you really want to delete the dataset?"))
{
     //delete code
}

How about just displaying a PopupPanel?

Something like this:

PopupPanel popup = new PopupPanel(true);
FlowPanel panel = new FlowPanel();
//add Button etc
popup.setSize("1100px","500px");
popup.clear();
popup.add(panel);
popup.show();
popup.center();

If you want to display a confirm dialog than this code is easier:

if (Window.confirm("Do you really want to delete the dataset?"))
{
     //delete code
}
我是有多爱你 2025-01-15 13:24:13

像这样的东西吗?

    ButtonCell buttonCell = new ButtonCell(){
        @Override
        public Set<String> getConsumedEvents() {
            // TODO Auto-generated method stub
            //return super.getConsumedEvents();
            Set<String> events = new HashSet<String>();
            events.add("click");

            return events;
        }
    };
    productTable.addColumn(new Column<ProductDetails, String>(buttonCell) {
        @Override
        public String getValue(ProductDetails object) {
            // TODO Auto-generated method stub
            return "Edit";
        }
        @Override
        public void onBrowserEvent(Context context, Element elem,
                ProductDetails object, NativeEvent event) {
            // TODO Auto-generated method stub
            super.onBrowserEvent(context, elem, object, event);
            if("click".equals(event.getType())){
                presenter.onEditButtonClicked(object);
            }
        }
    }, "Commands");

请尝试一下并让我知道结果。我刚刚写了,还没有测试它:|

Something like this?

    ButtonCell buttonCell = new ButtonCell(){
        @Override
        public Set<String> getConsumedEvents() {
            // TODO Auto-generated method stub
            //return super.getConsumedEvents();
            Set<String> events = new HashSet<String>();
            events.add("click");

            return events;
        }
    };
    productTable.addColumn(new Column<ProductDetails, String>(buttonCell) {
        @Override
        public String getValue(ProductDetails object) {
            // TODO Auto-generated method stub
            return "Edit";
        }
        @Override
        public void onBrowserEvent(Context context, Element elem,
                ProductDetails object, NativeEvent event) {
            // TODO Auto-generated method stub
            super.onBrowserEvent(context, elem, object, event);
            if("click".equals(event.getType())){
                presenter.onEditButtonClicked(object);
            }
        }
    }, "Commands");

Please try it out and let me know the result. I just wrote and havent test it yet :|

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文