EasyUI Forum
September 14, 2025, 07:31:06 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Treegrid cell focus not working in 1.4.2  (Read 9052 times)
bduguay
Newbie
*
Posts: 31


View Profile
« on: March 30, 2015, 10:11:38 AM »

I have a tree grid that when the user presses the space bar on the row, it focuses and selects the cell and allows them to edit it the data. When I upgraded to 1.4.2 the focus will no longer set on the field. The field to have focus is based on data already in the row.

The only thing that I've changed on my page are my script tags to point to the new easyui files. I even tried to include the patch on my page, but it changed nothing.

The fields are numberboxes.

Code:
// Select the cell to start editing in.
function selectCellToEdit(row) {
    // Get the editor for the treegrid based on if the row hasAssociates
var editor;
if (row.hasAssociates) {
// Set the focus based on if the hours need to be calculated for the row.
if (row.calculateHours) {
editor = $(currentGrid).treegrid('getEditor', {id:editingId, field:'businessPlanAssociates'});
} else {
editor = $(currentGrid).treegrid('getEditor', {id:editingId, field:'businessPlanHours'});
}
} else {
editor = $(currentGrid).treegrid('getEditor', {id:editingId, field:'businessPlanAmount'});
}
// Set focus in the cell and select the text
$(editor.target).focus().select();
}
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: March 30, 2015, 03:22:48 PM »

Please refer to this example http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=Row%20Editing%20in%20DataGrid
Logged
bduguay
Newbie
*
Posts: 31


View Profile
« Reply #2 on: March 31, 2015, 05:15:56 AM »

Thank you.

The following code worked.
Code:
($(editor.target).data('textbox') ? $(editor.target).textbox('textbox') : $(editor.target)).focus().select();
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!