I can't get search builder to remove the "empty" and "Not empty" options

I can't get search builder to remove the "empty" and "Not empty" options

desperadodesperado Posts: 159Questions: 33Answers: 4
edited March 2022 in SearchBuilder

I can't get search builder to remove the "empty" and "Not empty" options.

I want to remove these options because if I return null to my datatables they always throw an error so I always return a string " ". So empty and not-empty don't work in any of my tables.

I am trying to follow the instructions on this page but neither method is working for me to remove options.
https://datatables.net/extensions/searchbuilder/customConditions

Here is my example using the first method explained.
http://live.datatables.net/jasogevu/1/edit?js,output

Here is my example using the second method explained.
http://live.datatables.net/meraqayo/1/edit?js,output

This question has an accepted answers - jump to answer

Answers

  • desperadodesperado Posts: 159Questions: 33Answers: 4

    I figured out the correct way to alter search builder when using buttons.
    I tried extending buttons and it wasn't working then I tried adding the conditions clause in the a config section and it finally worked.
    That should be added to the documentation page if possible to make it easier for folks using buttons to understand how to do it.

    {   extend: 'searchBuilder',
                        config: {
                            conditions: {
                                string: {
                                    'null': null,
                                    '!null': null
                                },
                                date: {
                                    'null': null,
                                    '!null': null
                                },
                                num: {
                                    'null': null,
                                    '!null': null
                                }
                            }
                        }
                    }
    
  • sandysandy Posts: 913Questions: 0Answers: 236
    edited March 2022 Answer ✓

    Hi @desperado ,

    It is documented in this example, and also in the buttons documentation page - button.searchBuilder.

    Thanks,
    Sandy

  • desperadodesperado Posts: 159Questions: 33Answers: 4

    @sandy Sorry I didn't find the correct documentation. Thanks for pointing it out.

Sign In or Register to comment.