我创建了一个带有两个按钮的元素列表。第一个是"接受",另一个是"拒绝"。无论我按哪个按钮,我都希望将其从我的数据表中删除,并在没有删除元素的情况下更新我的列表。 我的问题是我的列表无法快速更新,所以我必须等一秒钟。
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
tools:context="com.backpaper.fragment.RecentSectionFragment">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/recenttoolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:titleTextColor="@color/colorAccent" />
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/placeSnackBar"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="@layout/recycler" /> </android.support.design.widget.CoordinatorLayout>
我的观点。接受
<p:commandButton value="Accept" update="mydatatable"
<f:setPropertyActionListener value="#{mymessage}"
target="#{myView.accept}" />
</p:commandButton>
我想做什么:MyView.accept()完成后执行更新。我试图通过oncomplete /成功更改更新,但我没有得到任何令人满意的结果。我正在寻找像TimeUnit.SECONDS.sleep(1);
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_INFO, "element removed", ""));
我怎么能这样做?
答案 0 :(得分:0)
即使消息不再发布,有人也给了我几乎正确的答案(这对我帮助很大,谢谢)
正确的答案是update="@this,mydatatable"