我有点卡住...我有一个对话框,如果您单击表单内的此按钮,则会打开该对话框:
public void ShowToast()
{
…
toast.Dismissed += Toast_Dismissed_ShowAgain;
lastShown = toast;
ToastDesktopNotificationManager.CreateToastNotifier().Show(toast);
}
private static void Toast_Dismissed_ShowAgain(ToastNotification sender, ToastDismissedEventArgs args)
{
if (args.Reason != ToastDismissalReason.UserCanceled)
ToastDesktopNotificationManager.CreateToastNotifier().Show(lastShown);
}
public override void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId)
{
// Determine if user clicked an action that should not lead to dimissal
if (something)
ToastDesktopNotificationManager.CreateToastNotifier().Show(lastShown);
}
这很好,显示对话框,调用prepare语句,所以一切正常。
如果我单击“保存”按钮上的对话框,就会出现问题:
<p:commandButton id="createProductButton" style="height: 36px; width: 36px" immediate="true" rendered="#{formController.selected.masterProduct}" icon="ui-icon-plus" actionListener="#{formItemController.createProduct()}" update="ProductCreateDlg" oncomplete="PF('ProductCreateDialog').show()"/>
因为从未调用productController.save方法,我也不知道为什么。我尝试添加ajax = true,将actionListener重命名为action,从对话框中删除整个表单,以不从其他表单中调用a,但仍然不执行任何操作。永远不会调用此方法。
这是ProductController类中的相关部分:
<p:commandButton id="save" actionListener="#{productController.save}" value="#{bundle.Save}" update="@([id$=productPanel]),:growl" oncomplete="PF('ProductCreateDialog').hide()" />
...这是对话框本身:
@Named("productController")
@SessionScoped
public class ProductController implements Serializable, IController {
...
public void save() {
if (getSelected() != null && getSelected().getId() != null && getSelected().getId() != 0) {
update();
} else {
controllerDelegate.createNoRedirect("ProductCreated");
}
}
...
}
我在这里想念什么?