jQWidgets Forums

jQuery UI Widgets Forums Dialogs and Notifications Window Window id in the events

This topic contains 1 reply, has 1 voice, and was last updated by  julz 13 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Window id in the events #4561

    julz
    Member

    Hi,

    I use windows to display some webcam streams. I don’t want all the streams to be loaded at once, but only when the window
    is shown. For this, I put an iframe in the window. That works well, but now I’d like the windows to be created dynamically, like this:


    for (i = 0; i < baseWindows.length; i++)
    {
    $('#' + baseWindows[i]).jqxWindow({ autoOpen: false, showCollapseButton: true, maxHeight: 400, maxWidth: 700, minHeight: 200, minWidth: 200, height: 300, width: 500, theme: 'darkblue' });
    }

    The problem I have here is with the ‘show’ event. If I bind the event like this:

    $(‘#’ + baseWindows[i]).bind(‘show’, function (event) { // Some code here. });

    I have no way to know what window it is. The goal of the for loop is that I don’t need to know which window i’m currently
    creating here. I just go through a list of windows name.

    I want my show event to set the iframe location. For this, I would need the event to give the window id and do something like:

    $(‘#jqxWindow’).bind(‘show’, function (event) { $(‘#’ + event.args.id + ‘iFrame’)[0].src = getUrlForWindow(event.args.id); });

    Sadly, there is no such event.args.id (or is there?)

    Could anyone give me a solution for this?
    Hoping I’ve been clear enough…

    Thanks.

    Window id in the events #4566

    julz
    Member

    Ok sorry; I found the solution, that was easy.

    I didn’t actually think of using this 😉

    So the answer would be: $(this)[0].id

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.