Is possible to filter blank fields on multi_select (YADCF)?

Is possible to filter blank fields on multi_select (YADCF)?

mgutbormgutbor Posts: 32Questions: 5Answers: 0

I want to know if its possible to get the rows with empty fields on this columns selecting (" ") or ("EMPTY") or something else on the column filter. I have a fiddle to explain this.

At first column (Status) I have three values (ON, OFF, (EMPTY)). My problem is to get the rows with empty values (Same row as PR00000003, PR00000005) selecting empty value on the filter.

Thanks in advace.

Replies

  • kthorngrenkthorngren Posts: 20,423Questions: 26Answers: 4,794
  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    edited February 2017

    Since there seems to be some sort of issue with yadcf/select2 and empty string for filtering I can suggest the following solutions:

    1) Use regex (see this jsfiddle) -

        var oTable = $('#example').DataTable();
    
        yadcf.init(oTable, [
            {
                column_number: 0,
                filter_type: 'multi_select',
                append_data_to_table_data: 'before',
                data: [ {value:'^$', label:'Empty' }], 
                filter_match_mode: 'regex',
                select_type: 'select2'
        }]);
    

    2) Use datatables HTML5 data-* attributes ,

    3) Use Chosen plugin (IMO Select2 fits datatables/yadcf better) instead of select2
    see jsfiddle sample

            var oTable = $('#example').DataTable();
    
            yadcf.init(oTable, [
            {
                column_number: 0,
                filter_type: 'multi_select',
                append_data_to_table_data: 'before',
                data: [ {value:' ', label:'Empty' }], 
                filter_match_mode: 'exact',
                select_type: 'chosen'
            }]);
    

    always bet on yadcf

  • mgutbormgutbor Posts: 32Questions: 5Answers: 0

    Hi again and thanks.

    I have a new question about that. Will be possible to filter the empty fileds on filter_type: 'text' ???

    Here is my fiddle and my explanation:

    I want to have any possiblities to get the empty field on column PROJECT (Row with Status=ADD and RFC Status=Accepted).

    Thanks again in advance.

  • maxasdmmaxasdm Posts: 2Questions: 0Answers: 0

    Hi Daniel. I want to know if is posible filter blank and not blank values. Both options. I take the option 3 example and it works. I need filter with Not Empty option also. How to deny value:' '.
    Thanks

  • maxasdmmaxasdm Posts: 2Questions: 0Answers: 0

    I'm sorry. It works now.

This discussion has been closed.