在按钮上单击刷新表并添加新行

发布于 2025-01-07 22:31:58 字数 195 浏览 1 评论 0原文

我创建了一个表格和一个按钮。单击该按钮后,我需要添加行。 为此,我使用了 buttonClick 方法,在该方法中我在表中添加了一行。

问题是该行添加到表中(我可以在日志中看到), 但屏幕变成空白,只显示按钮。

如果我退出并再次导航到屏幕,那么我可以看到添加的新行。

添加后如何立即看到添加的新行。

I have created a table and a button. On click of that button i need to add the row.
For that i have used buttonClick method in which i am adding a row in the Table.

The problem is that the row in added to the table (I can see in the logs),
but the screen becomes blank with just the button displayed.

If I exit and navigate again to the screen, then i can see the new row added.

How can i see the new row added immeditalety once added.

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

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

发布评论

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

评论(2

〆凄凉。 2025-01-14 22:31:58

某些代码可能有助于进一步了解可能出现的问题,但我还建议您在添加表行后直接调用以下代码行。

yourTable.setContainerDataSource(yourTable.getContainerDataSource());

这将更新表的数据源并强制重新绘制。如果您提供一些代码也许可以提供更多帮助

Some code would probably help to further see what might be wrong, but I would also recommend you to call the following code line directly after you have added a table row.

yourTable.setContainerDataSource(yourTable.getContainerDataSource());

This will update the datasource for your table and force a repaint. If you provide some code maybe more help can be provided

家住魔仙堡 2025-01-14 22:31:58

使用 IndexedContainer 在按钮单击期间在表中添加新行。

示例

Create IndexedContainer
-----------------------
private IndexedContainer getTblTerminals(IndexedContainer container) 

{

container.removeAllItems();

container.addContainerProperty("Terminal_Id", String.class, defaultValue);

g_TermialPojo=ws.readAll();

for(Terminal pojo:g_TermialPojo)

{


Object itemId=container.addItem();

strTid=String.valueOf(pojo.getTid());


            container.getContainerProperty(itemId,"Terminal_Id").setValue(strTid.toString());


        }

        return container;

}


//To add indexedcontainer in your table
-------------------------------------------

Example



        table.setContainerDataSource(getTblTerminals((IndexedContainer)table.getContainerDataSource()));


table.setImmediate(true);

Using IndexedContainer to add new row in table during button click..

Example

Create IndexedContainer
-----------------------
private IndexedContainer getTblTerminals(IndexedContainer container) 

{

container.removeAllItems();

container.addContainerProperty("Terminal_Id", String.class, defaultValue);

g_TermialPojo=ws.readAll();

for(Terminal pojo:g_TermialPojo)

{


Object itemId=container.addItem();

strTid=String.valueOf(pojo.getTid());


            container.getContainerProperty(itemId,"Terminal_Id").setValue(strTid.toString());


        }

        return container;

}


//To add indexedcontainer in your table
-------------------------------------------

Example



        table.setContainerDataSource(getTblTerminals((IndexedContainer)table.getContainerDataSource()));


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