This is a migrated thread and some comments may be shown as answers.

Having issues with my window after close

1 Answer 258 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 25 Feb 2012, 12:44 AM
Hello everyone. 

I'm having an issue with using the window. The window loads fine on the first try, but then when I go to click the window again, I have to click twice on the button to have the window open. It's very strange indeed.

I am loading the call to the button calling the window function via the kendo grid. below is my code: 

var users = [
        {   userName : "Jeremy.Miller@radolo.com",
            firstName: "Jeremy",
            lastName: "Miller",
            userRole: "Administrator" ,
            userID:"1" },
        {   userName : "Josh.Grippo@radolo.com",
            firstName: "Josh",
            lastName: "Grippo",
            userRole: "Administrator",
            userID:"2"  },
        {   userName : "John.Huisman@radolo.com",
            firstName: "John",
            lastName: "Huisman",
            userRole: "Administrator",
            userID:"3"  }
    ];
 
$("#editUsers").kendoGrid({
     
    dataSource: {
        data: users,
        schema: {
            model: {
                fields: {
                    username: { type: "string" },
                    firstName: { type: "string" },
                    lastName: { type: "string" },
                    userRole: { type: "string" },
                    userID: { type: "number" },
                    resetPassword: { type: "string" },
                    editUser: { type: "string" },
                }
            }
        },
        pageSize: 10
    },
    height: 280,
    scrollable: {
        virtual: true
    },
    columns: [
        { title: "Username", field:"userName"},
        { title: "First Name", field:"firstName"},
        { title: "Last Name", field:"lastName"}, 
        { title: "User Role", field:"userRole"},
        { title: "Reset Password",
        template: "<a href='reset-password.aspx?userID=#= userID #'>Reset Password</a>"},
        { title: "Edit User",
        template: "<button class='popup-window icon edit' title='edit this user'>Edit This User</button> " },
        { command: "destroy"  }
    ],
    editable: true
});
 
 
 
$(".popup-window").click(function () {
    var myWin = $(".modal-window");
    if (!myWin.data("kendoWindow")) {
        // window not yet initialized
        myWin.kendoWindow({
            draggable: true,
            modal: true,
            resizable: false,
            title: 'Edit User Information',
            content: 'edit-user.aspx',
        });
    } else {
        // reopening window
        myWin.data("kendoWindow")
            .content("Loading...") // add loading message
            .refresh(href) // request the URL via AJAX
            .open(); // open the window
    }
 
    return false;
});

You can view the issue here: http://10.50.3.30/rockhabitsdev/edit-users.aspx

So, basically what I would like to happen is you have a window that opens that allows you to edit the users info . You can close/cancel if you need to. But each "edit" button will allow you to edit that person's info. Additionally, the "X" will allow you to delete the table row.

Currently the first window opens fine. When I close the window, the next time I try to open a window the button disappears and I have to click again to have the window open again. If I click on the "X" to delete a row, the button functionality goes away and it refreshes the page on click, which does not seem right.

I grabbed the bit about opening a new window from another post I found on the help forum. It was from an admin, so I can only assume that part is correct.

I'm not getting any errors in firebug, so I don't know what's going on.

Any help would be appreciated. Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Jeremy
Top achievements
Rank 1
answered on 25 Feb 2012, 01:06 AM
It seems I've found out the reason for why the button disappears. It seems it has to do with the edit function. So that explains that.

However, after turning off the option, I still am not able to load the window a second time. 

Any ideas?
Tags
Window
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Jeremy
Top achievements
Rank 1
Share this question
or