Custom Search Builder

Custom Search Builder

jankumar1980jankumar1980 Posts: 6Questions: 2Answers: 0

How to Custom search builder layout show after Click Search then Open AnyCondition

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    I'm not clear what the issue. Could you you take this example, please, and give step-by-step instructions on what you'd like to happen rather than the default behaviour?

    Colin

  • jankumar1980jankumar1980 Posts: 6Questions: 2Answers: 0

    please see attachement image and how to implement. please share. Thank you

  • jankumar1980jankumar1980 Posts: 6Questions: 2Answers: 0
    edited October 2023

    My code is below

    $(document).ready(function () {
                var table = $('#Search').DataTable({
                    lengthChange: true,      
                    dom: 'lBfrtip',
                    buttons: [
                        'copy',
                        'excel',
                        'csv',                 
                        {
                            text: 'PDF',
                            extend: 'pdfHtml5',
                            action: function (e, dt, node, config) {
                                PrintDiv();
                            }
                        },
                        'colvis',
                    ],
                    searchBuilder: {
                        conditions: {
                            num: {
                                'MultipleOf': {
                                    conditionName: 'Multiple Of',
                                    init: function (that, fn, preDefined = null) {
                                        var el = $('<input/>').on('input', function () { fn(that, this) });
                                        if (preDefined !== null) {
                                            $(el).val(preDefined[0]);
                                        }
                                        return el;
                                    },
                                    inputValue: function (el) {
                                        return $(el[0]).val();
                                    },
                                    isInputValid: function (el, that) {
                                        return $(el[0]).val().length !== 0;
                                    },
                                    search: function (value, comparison) {
                                        return value % comparison === 0;
                                    }
                                }
                            }
                        }
                    }
                });           
                var buttonContainer = table.buttons().container().appendTo('#Search_wrapper .col-md-6:eq(0)');
                var searchBuilderContainer = table.searchBuilder.container();
                buttonContainer.insertBefore(table.table().container());
                searchBuilderContainer.insertBefore(table.table().container());
            });
    

    Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    You can put SearchBuilder into a button as shown here. Is that what you are looking for?

    Allan

Sign In or Register to comment.