简体   繁体   English

数据表YADCF-输入侧重于负载

[英]Datatables YADCF - input focus on load

I'm using the excellent Datatables with Vedmack's YADCF plugin, which is working great. 我在Vedmack的YADCF插件中使用了出色的数据表,效果很好。 The only thing I can't figure out is ... 我唯一不知道的是...

How do I switch focus to a specific YADCF filter text input box on page load? 如何在页面加载时将焦点切换到特定的YADCF过滤器文本输入框? I've tried the following in and outside of document.ready, but neither work: 我已经在document.ready内外尝试了以下方法,但均无济于事:

$('#yadcf-filter--Table-7').ready(function() {
    $('#yadcf-filter--Table-7').focus();
});

... and ...

$('#yadcf-filter--Table-7').load(function() {
    $('#yadcf-filter--Table-7').focus();
});

The input box doesn't appear for about 2 seconds after page load and the ID is appended by the plugin, which I assume is why I'm struggling to get it to work. 页面加载后大约2秒钟内该输入框不会出现,并且ID由插件附加,这是我努力使它起作用的原因。

Any ideas, please? 有什么想法吗?

Thanks! 谢谢!

Sorry - ignore this, the following works fine, I'd just made a daft mistake earlier on: 抱歉-忽略此问题,以下方法可以正常工作,我之前刚刚犯了一个愚蠢的错误:

$(document).ready(function() {
    yadcf.init(Table, [
        etc, etc...
    ];
    $('#yadcf-filter--Table-7').ready(function() {
        $('#yadcf-filter--Table-7').focus();
    });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM