PDA

View Full Version : how to simulate a click on a menu in web desktop



phamtranquocviet
22 Jan 2014, 1:58 PM
I am using sencha web desktop. Right above the logout menu is my "Change Password" menu. When you click on it, change password ui appears for you to type in old, new password, etc to change password.

When the user logs in for the first time, I want to simulate a click event on "Change Password" menu so that it forces the users to change password. The following codes can get a hold of the "Change Password" menu, but the "Change Password" UI refuses to show up no matter what I try. Please help.

Ext.onReady(function() {
Ext.getBody().mask("Loading desktop. Please wait...");
var desktop;

desktop = Ext.create("MyDesktop.App", {
acl: data.acl,
userFullName: data.userFullName
});

desktop.onReady(
function() {
Ext.getBody().unmask();
changePasswordMenu = Ext.ComponentQuery.query("#change-password-menu-item")[0];
changePasswordMenu.fireEvent("click");
},
this
);
});

Farish
23 Jan 2014, 12:30 AM
its probably just a window (change password). try to just display it using the show method.


window.show();

phamtranquocviet
23 Jan 2014, 8:39 AM
You are almost right. It's just a window. So, just instantiate it. Here it is:




desktop.onReady(
function() {
Ext.getBody().unmask();
if(data.success === true && data.forceChangePassword === true) {
Ext.create("Iip.view.giip.login.PasswordChange", {closable: false});
}
},
this
);

Gary Schlosberg
23 Jan 2014, 10:14 AM
Glad you found your answer, and thanks for sharing the solution with the community.