EasyUI Forum
May 16, 2024, 06:11:54 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to change tab and set focus on first textbox?  (Read 10981 times)
rannacher
Jr. Member
**
Posts: 52


View Profile
« on: March 30, 2016, 03:23:17 PM »

onblur of a button in first tab I want to switch to second tab and set the focus to the first textbox on top

button with
   onblur="$('#tt').tabs('select',1)"

and tabs with
                data-options="
                         onSelect:function(title,index)
                      {
                            if (index==0)
                        {
                               $('#NAME').textbox('textbox').focus();
                        }
                        else if (index==1)
                        {
                               $('#ADDRESS').textbox('textbox').focus();
                               $('#ADDRESS').textbox('textbox').select();
                             }
                         }
                         "         

BUT it does not work... It swtiches to the second tab and it also highlights the text in the top textbox,
butu this "selection" is only "grey" (and not blue as it should be) and hence you cannot type.
In order to make it work you have to use the mouse and click the dialog top menu/panel - then grey background turn blue and it works.

onselect handling in the tab data-options also works when you directly click the tabs. Then the text gets directly huglighted blue typing is directly possible.

TRICKY TGRICKY ... PLS HELP
AND THX in ADVANCE!
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: March 31, 2016, 02:03:11 AM »

Please try to delay a little time to let the textbox got focus.
Code:
setTimeout(function(){
$('#ADDRESS').textbox('textbox').focus().select();
},0);
Logged
rannacher
Jr. Member
**
Posts: 52


View Profile
« Reply #2 on: March 31, 2016, 05:33:13 AM »

thx for reply but still doesnt work - see new code below.

symptoms are like this - see SCREENSHOT:

after 2 secs the text "abc" gets selected (grey background selection?) but when you start typing nothing happens.
You need to manually click the panel of the dialog (not the tab) then the text "abc" gets selected with BLUE background and when you start typing the text gets replaced/changed.

Again - when I switch manually between the tabs (not via blur) it is different behaviour and works perfect.
But I need the blur on the button to avoid the mouse...

STWORTHY - THX AGAIN FOR HELP!


BR Mike..

          <div id="tt" class="easyui-tabs" style="width:395px;height:350px"
                data-options="
                         onSelect:function(title,index)
                      {
                            if (index==0)
                        {
                               $('#NAME').textbox('textbox').focus();
                        }
                        else if (index==1)
                        {
                               $('#ADDRESS').textbox('textbox').focus();

setTimeout(function(){
   $('#ADDRESS').textbox('textbox').focus().select();
},2000);

                          //$('#dlg').dialog('refresh',''); 
                             }
                         }
                         "         
          >
Logged
rannacher
Jr. Member
**
Posts: 52


View Profile
« Reply #3 on: March 31, 2016, 06:11:33 AM »

FOUND one HINT

if I "come" onblur from the last textfield in the first tab then it works, see below
<script type="text/javascript">
  var tb = $('#STATUS').combobox('textbox');
  tb.bind('blur',function()
  {
    $('#tt').tabs('select',1);
  });
</script> 

SO the mistake is onbur from the BUTTON in the DIALOG is not able to set focus on the next tab's textbox.

Any idea how I can handle as I need to go over the buttons and not directly from last field first tab to first field second tab???

THX AGAIN!!!
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!