PDA

View Full Version : [CLOSED] Find Notification Dialogs



cwolcott
Feb 27, 2013, 2:14 PM
I have a panel with a various fields. One is a user name with a vCard icon next to it as a button. When I click on the icon I show a Notification dialog with User Information displayed. I defined the following attributes on the notification HideDelay of 5000ms, ShowPin is true, PinEvent = 'clicked'. The user may bring up the notification and click on it, thus pinning the window. The notification is not modal.

My question is how can I find all the notification windows and close them via code? The reason is if the user pinned the notification window and then clicks somewhere else in the application I need to close the notification because it will have nothing to do with other parts of the system.

One easy fix would be to make the notification modal.

Vladimir
Feb 27, 2013, 3:58 PM
You can find all notifications windwows via


Ext.ComponentQuery.query("window[cls~=' x-notification']")

cwolcott
Feb 27, 2013, 5:20 PM
Is there an equivalent for behind code?

Vladimir
Feb 27, 2013, 5:36 PM
No, notifications are absent on the server side. Do you need all notifications or particular only?
You can always to set ID to notification and use GetCmp to destroy it from code behind


X.GetCmp<Window>("Notification1").Close();

cwolcott
Feb 28, 2013, 3:08 PM
I just need a particular notification window based on ID. So the following code works when the notification exists:



X.GetCmp<Window>("Notification1").Close();


But how can I test if X.GetCmp<Window>("Notification1") exists before trying to close it? Otherwise the code hangs.

Vladimir
Feb 28, 2013, 3:16 PM
Just create javascript code


function closeNotification(id)
{
var cmp = Ext.getCmp(id);
if (cmp) {
cmp.close();
}
}


and call on the server side


X.Js.Call("closeNotification", "Notification1");

cwolcott
Feb 28, 2013, 4:04 PM
Perfect, thanks for the solution. Please close the thread.