PDA

View Full Version : [CLOSED] Window Autoload



cwolcott
Apr 10, 2012, 11:26 PM
The code below was working just fine in Rev 3919, but after jumping to 3930 the parameter is always null.

Below is the javascript code called after I press the Inactivate button.



// Show the user inactivation confirmation popup passing the currently selected userIds values as URL parameters.
function showInactivateUsersPopup() {

#{UserPopup}.title = 'Inactivate User(s)';
#{UserPopup}.show();
// The Inactivate User window is an autoload iFrame, meaning it is a full page (not just a control).
// In order to get all of the selected userIds to it, the most straightforward solution is to
// rewrite the url with a "Ids" param whose value is a comma-seperated list of userIds.
#{UserPopup}.load({
url: './UserInactivate.aspx',
params: {Ids: getSelectedRecordIds(#{ActiveUsersGridPanel}.getSe lectionModel()).join(',') },
scripts: true,
discardUrl: true,
nocache: true
});
}

// Returns the user ID for each record currently selected in the grid.
function getSelectedRecordIds(selectionModel) {
return Ext.Array.pluck(Ext.Array.pluck (selectionModel.getSelection(), 'data'), 'UserId');
}


The window definition used as a popup.



<%-- Add a default URL so I don't receive a 'No URL specified' the first time the window is shown --%>
<ext:Window ID="UserPopup" runat="server" Resizable="false" Closable="true" Hidden="true">
<Loader runat="server" Mode="Frame" DisableCaching="true" Url="./UserInactivate.aspx?Ids=0">
<LoadMask ShowMask="true" />
</Loader>
</ext:Window>


The UserInactivate.aspx page, but Request.Params["Ids"] is now returning null.



public partial class UserInactivate : System.Web.UI.Page
{
private List<int> userIds;

protected override void OnInit(EventArgs e)
{
base.OnInit(e);

userIds = Request.Params["Ids"]
.Split(',')
.Select(ea => String.IsNullOrEmpty(ea) ? 0 : Convert.ToInt32(ea))
.ToList();
}

protected void Page_Load(object sender, EventArgs e)
{
Message.Html = String.Format("<b><u>{0}</u></b> {1} been selected to be inactivated.",
userIds.Count(),
(userIds.Count() == 1) ? "user has" : "users have");

}
}

cwolcott
Apr 10, 2012, 11:35 PM
Ok, I had a brain freeze. Please close or delete this thread because everything works. The context menu button was not configured correctly, but the toolbar menu button was. Oops, my mistake.

geoffrey.mcgill
Apr 11, 2012, 12:00 AM
Ok, I had a brain freeze. Please close or delete this thread because everything works. The context menu button was not configured correctly, but the toolbar menu button was. Oops, my mistake.

No worries. Happy to hear it's working.