display the search Builder on a specific Div

display the search Builder on a specific Div

jgknqwvgfhgkkkuiej@ckptr.comjgknqwvgfhgkkkuiej@ckptr.com Posts: 3Questions: 2Answers: 0

Hello!

I am trying to display the DataTables SearchBuilder in a custom div on my page, but I am facing some issues. Could you please provide guidance on the correct syntax and method to achieve this?

I attempted to use the dom option and jQuery functions, but nothing seems to work. I have attached my code snippets for your reference.

Thank you for your assistance.

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    Answer ✓

    It doesn't look like you are using the dom option to display the SearchBuilder. Guessing you want to display the SearchBuilder here:

        <div style="display: flex; flex-direction: row-reverse;">
          <div class="searchDiv"></div>
        </div>
    

    This example shows how to place the SearchBuilder where you want. If you still need help please provide a simepl test case showing what you are trying to do.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    If you want to insert the SearchBuilder control somewhere other than the area immediately around the table (i.e. into a custom div as you said), then see this example which shows how that can be done.

    Allan

  • jgknqwvgfhgkkkuiej@ckptr.comjgknqwvgfhgkkkuiej@ckptr.com Posts: 3Questions: 2Answers: 0
    edited July 31

    Thank you for your help,
    I found the solution:

    initComplete: async function () {
    var searchBuilderContainer = await this.api().searchBuilder.container();
    $('.ricerca-avanzata').append(searchBuilderContainer);
    },

    I had to use containre() function to display the search builder in my div with class name 'ricerca-avanzata' .
    Note: ricerca-avanzata' means advanced research in italian language.

Sign In or Register to comment.