简体   繁体   中英

YADCF initial select latest value

I woud like to select the first value from YADCF selector at page load. I can do this manually:

yadcf.exFilterColumn(oTable, [
    // 1 being the column number, and "value" being the value you want it to initially search for when page loads
    [4, "3/2020"]

...but it is possible to automatically select the most recent value (3/2020 in the example)?

在此处输入图片说明

You can use the 0.9.4.beta.37

yadcf.initOnDtXhrComplete(function() { 
    yadcf.exFilterColumn(oTable, [[4, $("#yadcf-filter--mytable-4 option:eq(1)").val()]], true); 
    //third argument is true so that the filter will happen immediately
});

Here is the docs for the initOnDtXhrComplete

  • initOnDtXhrComplete Description: Allows to set a callback function to be called after dt xhr finishes Arguments: function to do some logic Usage example: yadcf.initOnDtXhrComplete(function() { $("#yadcf-filter--example-0").multiselect('refresh'); });

See working fiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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