vedmack / yadcf

Yet Another DataTables Column Filter (yadcf)
http://yadcf-showcase.appspot.com/
MIT License
731 stars 285 forks source link

Pre Selecting an escaped value #612

Closed adrianmihalko closed 4 years ago

adrianmihalko commented 4 years ago

I am opening here a bug report, following my question on Stackoverflow.

The problem is, that it's currently not possible to populate select input at init:

67rfcw4e0m37

it's empty, but filtering works correctly.

As found by Datatables developer on their forum , maybe there is a race condition which is causing the YADCF plugin to clear the input value.

crgutxl7f456

As you can see it shows up for a sec, then it's become hidden.

I tried multiple solution, but none seem to be work:

$('#mytable').on( 'init.dt', function () {
     yadcf.exFilterColumn(oTable, [[4, '3/2020']], true);
  } );
 yadcf.initOnDtXhrComplete(function() { 
   yadcf.exFilterColumn(oTable, [[4, $("#yadcf-filter--mytable-4 option:eq(1)").val()]], true);
  });

Test site:

init.d yadcf.initOnDtXhrComplete

vedmack commented 4 years ago

@adrianmihalko please try the 0.9.4.beta.39 https://www.dropbox.com/s/g2ctbdq6zfuziy4/jquery.dataTables.yadcf.js?dl=0

update it on your site so I can see how it works for you

adrianmihalko commented 4 years ago

@vedmack Hi Daniel, looks good:

https://bow.thingiverse.ml

thanks for your time 👍

vedmack commented 4 years ago

@adrianmihalko cool, can u please provide a test page for a scenario in which you try to pre-select a value that does not exist in the select, for example, 6/2020 (I want to see the flow...)?

adrianmihalko commented 4 years ago

@vedmack sure: https://bow.thingiverse.ml/index2.html

vedmack commented 4 years ago

@adrianmihalko you can get the final 0.9.4.beta.40 js version with the fix