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

focus on popup window editing

3 Answers 507 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bertha
Top achievements
Rank 1
Bertha asked on 10 Jul 2014, 02:10 PM
I want to focus on the first input field while popup editing.  why this code is not working?
thanks.

‚Äč $("#gdAccessSetup").kendoGrid({
dataSource: adminDataSource,
sortable: true,
pageable: true,
//height: 200,
edit: onGridEditingSetup,
toolbar: ["create"],
columns: [
{ field: "Username", title: "Username", width: "150px", attributes: { style: "text-align:left" }, editor: usernameAutoCompleteEditor },
{ command: ["edit", "destroy"], title: " ", width: "200px" }],
editable: "popup"
});

function onGridEditingSetup(arg) {
arg.container.find("input[name='Username']").attr('maxlength', '20');
arg.container.data('kendoWindow').bind('activate', function (e) {
arg.container.find("input[name='Username']").focus();
})
}

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 14 Jul 2014, 07:42 AM
Hello Bertha,

The problem comes from the fact that the focus() is called before the window has finished its loading animation and therefore the focus is not correctly placed. I have created an example that shows the functionality that you are looking for, please check it out and let me know if it helps:

http://trykendoui.telerik.com/@Kiril/Ijep

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bertha
Top achievements
Rank 1
answered on 14 Jul 2014, 01:43 PM
Yes.  It worked correctly.  Thanks for the example.
0
Kiril Nikolov
Telerik team
answered on 15 Jul 2014, 07:14 AM
Hello Bertha,

I am glad to hear that the proposed solution helped.

In case you have any questions, please do not hesitate.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Bertha
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Bertha
Top achievements
Rank 1
Share this question
or