Yet Another DataTables Column Filter - (yadcf) - Page 4

Yet Another DataTables Column Filter - (yadcf)

124»

Replies

  • Fever905Fever905 Posts: 1Questions: 0Answers: 0

    Hi there - How am I able to preset the date in the Min field of the Date selector? I tried putting: (column 17 is my field with the date) ..
    [code]
    yadcf.exFilterColumn(oTable, [[17, "02/02/2015"]]);
    [/code]

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    Hi,

    Take a look at the docs: https://github.com/vedmack/yadcf/blob/master/lab/jquery.dataTables.yadcf.js#L197

    yadcf.exFilterColumn(oTable, [[2, {from: "", to: "11/25/2014"}]]); 
    

    Daniel

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    yadcf 0.8.7 is out! Added support ColReorder / Complex headers / Filter multiple columns / and much much more.

    Read changelog for more info

    http://yadcf-showcase.appspot.com/

  • Spaghetti_MonsterSpaghetti_Monster Posts: 3Questions: 0Answers: 0
    edited February 2015

    Love YADCF! Great work.

    I was noticing that the slider doesn't seem to work on a touch device.

    Any suggestions on using a slider such as Ion.RangeSlider (http://ionden.com/a/plugins/ion.rangeSlider/demo.html) in the place of the current range slider?

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    @Spaghetti_Monster , thanks, just include the jQuery UI Touch Punch on your page and it should make the slider work just fine on mobile, see similar question on SO

  • Spaghetti_MonsterSpaghetti_Monster Posts: 3Questions: 0Answers: 0

    Excellent.

    Thanks Daniel!

  • bdunsmuirbdunsmuir Posts: 17Questions: 4Answers: 0
    edited March 2015

    Daniel, do I have to specify a filter for every column? I only need to filter a few columns out of about 30.

    Can I do:

    yadcf.init(oTable, [
            {column_number : 0},
            {column_number : 4, data: ["Yes", "No"], filter_default_label: "Select 
            ]);
    
  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    @bdunsmuir ,

    1) No need to specify for every column (it will be such a waste of code).

    2) Yes you can :)

  • bdunsmuirbdunsmuir Posts: 17Questions: 4Answers: 0
    edited March 2015

    Thanks Daniel, I've started using the plugin and have run into a problem with select2.

    I tried using the latest versions but the did not work, seemed to have an issue with the "destroy" command. I am now using version 3.5.2 and it is working.

    What version do you recommend?

    When using the multi_select option, I can select multiple options but it only filters on one. Your showcase page has the same issue.

    If you select "Some Data 1" and then "Some Data 2", it will only look for "Some Data 2".

    I tried adding the multiple option with this line, but it did not work. Any ideas?

    {column_number : wc_index, filter_type: "multi_select", select_type:'select2', filter_default_label:'Select WC', select_type_options:'multiple'}
    

    Awesome plugin!

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    Currently its better to use the selec2 v.3.5 (there is an open issue for version 4 - https://github.com/vedmack/yadcf/issues/171 )

    As to the second issue with the ("Some Data 1" and then "Some Data 2") it was fixed in the latest yadcf version you can check the showcase / github

  • bdunsmuirbdunsmuir Posts: 17Questions: 4Answers: 0
    edited March 2015

    Thank you, Daniel. I'm using the latest version of yadcf. Once I set the filter type to exact match, it worked for me.

    I do get an error in the console when I select more than one option, but it doesn't seem to affect anything. The error is:
    Uncaught TypeError: Cannot read property '0' of null

    On this line of select2:
    function focus($el) { if ($el[0] === document.activeElement) return;

    Is there a way to have the pre-populated select list from the table, and add a custom selection?

    Example. List is:
    A
    B
    C
    D
    E

    I want to add a selection called "A-C". When selected, it will filter for A,B or C.
    Can this be done?

    Thanks for the help, I very much appreciate it.

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    edited March 2015

    @bdunsmuir , it should work without the exact too (see in showcase) , regarding the Cannot read property '0' of null I need to see a live example that reproduces it (jsbin/jsfiddle)
    As to the "A-C" filter A,B or C you should use the filter_type: custom_func or multi_select_custom_func, see it in action on showcase (first column)

  • bdunsmuirbdunsmuir Posts: 17Questions: 4Answers: 0

    Daniel, Here's how I'm doing it now. I have workcenters A,B,C,D,E. Your plugin populates these values into the multi-select list automatically.

    I want to add an option to the list that will filter for A,B & C.

    I do that using the custom function below. Now the multi-select list is no longer auto-populated like before, I have to manually add all the possible filter values to the list myself.

    Is there a way to create a custom filter and add it to the list, but still have the list auto populated with all the possible filters?

    Perhaps I am doing this all wrong. Code below:

     function workcenter_filters(filterVal, columnVal) {
        
        var final_values='';
        var found;
        if (columnVal === '') {
          return true;
        }
    
        if (filterVal==null) {
          found = 1;
        }else{
        
        //Loop through all the values in fliterVal array
             $.each(filterVal, function( index, value ) {
              if (value == 'ABC') {  //If we are adding the ABC group of filters
            final_values=final_values+"A|B|C";
              }
               else{
             final_values=final_values+value+"|";  //Add a single workcenter name
               }
    
            });
    
          found = columnVal.search("/:-\]|:\\)|"+final_values+":D/g"); 
    
        }
    
        if (found!== -1) {
          return true;
        }
        return false;
          }
          
          yadcf.init(oTable, [
            {column_number : wc_index,
                select_type:'select2',
            filter_type: "multi_select_custom_func",
            custom_func: workcenter_filters,
            data: [   
              {value: 'ABC', label: 'ABC'},
              {value: 'A', label: 'A'},   
              {value: 'B', label: 'B'},
              {value: 'C', label: 'C'},
              {value: 'D', label: 'D'},
                      {value: 'E', label: 'E'},
            ],
            filter_default_label:'All WC'
    
            }
      ]);
    
  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    Is there a way to create a custom filter and add it to the list, but still have the list auto populated with all the possible filters?

    No, there is no such option (but you can ask for it on github page of yadcf (new issue)

    Regarding your posted code, it looks ok, its up to you to write the right code for your custom search...

    For future questions please use stackoverflow and tag it with yadcf, I don't want to spam this forum :)

  • bdunsmuirbdunsmuir Posts: 17Questions: 4Answers: 0

    Thank you, Daniel. I entered a couple of issues on github. Hopefully they are issues and not my ineptness at programming.

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    yadcf 0.8.8 is out!

    New features added , bugs were fixed

    See changelog

    Showcase

  • SradesignSradesign Posts: 25Questions: 4Answers: 1

    Hi Daniel,

    I have an issue with your plugin first of all I have to have the date range filter based on date and time not just date and second your plugin is not supporting bootstrap and stop working with bootstrap.

    Best Regards,
    Ali.M

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    yadcf support only date filtering if you want it to support date with time you need to open a feature request on github, yadcf does support bootstrap - tested my self and I know it works for others too, you can provide a jsbin with your issue and will take a look at it

  • SradesignSradesign Posts: 25Questions: 4Answers: 1

    I just put my request in github thanks for your reply hope to see this feature soon.

This discussion has been closed.