EasyUI Forum
March 28, 2024, 03:44:20 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: [SOLVED] Datagrid filter - Focus  (Read 3891 times)
jega
Full Member
***
Posts: 190


View Profile
« on: June 11, 2018, 12:47:36 AM »

Hi.

Have a strange problem, that i can't see why.

Sample:

Datagrid with 2 columns, 1 = userID, 2 = personName

      dg.datagrid('enableFilter',[
         {
            field:'personName',
            type:'textbox',
            op:['contains','equal'],
            defaultFilterOperator: getCookie("personSearch - personName - filterOperator")
         }
      ]);

After that, i use    $( "input.datagrid-filter[name='userID]" ).focus(); and it works

But when i do $( "input.datagrid-filter[name='personName]" ).focus(); there is no focus

Removing

         {
            field:'personName',
            type:'textbox',
            op:['contains','equal'],
            defaultFilterOperator: getCookie("personSearch - personName - filterOperator")
         }

from enableFilter, it works with $( "input.datagrid-filter[name='personName]" ).focus();


« Last Edit: June 11, 2018, 02:13:11 AM by jega » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: June 11, 2018, 01:39:20 AM »

Call 'getFilterComponent' method to get the filter component and then focus on it.
Code:
var tb = $('#dg').datagrid('getFilterComponent','personName');
tb.textbox('textbox').focus();
Logged
jega
Full Member
***
Posts: 190


View Profile
« Reply #2 on: June 11, 2018, 02:12:53 AM »

Hi stworthy

Thanks. Works as expected.
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!