EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jega on June 11, 2018, 12:47:36 AM



Title: [SOLVED] Datagrid filter - Focus
Post by: jega 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();




Title: Re: Datagrid filter - Focus
Post by: stworthy 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();


Title: Re: Datagrid filter - Focus
Post by: jega on June 11, 2018, 02:12:53 AM
Hi stworthy

Thanks. Works as expected.