DataTables ColumnControl not sending search value in Laravel server-side processing

DataTables ColumnControl not sending search value in Laravel server-side processing

raaazzaraaazza Posts: 2Questions: 2Answers: 0

Question:

I'm using the DataTables ColumnControl extension with Laravel (server-side processing) and running into an issue with column-level search.

Here’s an example of what my Ajax payload looks like:

{
    "data": "name",
    "name": "name",
    "searchable": true,
    "orderable": true,
    "search": {
        "value": "",
        "regex": false,
        "fixed": [
            {
                "name": "dtcc",
                "term": "function(haystack) {\n          return !haystack.toLowerCase().includes(searchTerm);\n        }"
            }
        ]
    }
}

As you can see, the search.value field is empty — only a fixed search function string is included.
Because of that, my Laravel backend never receives the actual search term (e.g., the text typed in the filter box).

My questions:

  1. How can I get the actual search text value (search.value) to be sent with the Ajax request?
  2. Is there a built-in way to make ColumnControl use the standard DataTables search behavior with Laravel server-side processing, instead of sending fixed function strings?
  3. Or do I need to manually handle the search event and inject the search value before sending the Ajax request?

Any clear example of how to use ColumnControl’s built-in search with Laravel would be really helpful.

Answers

  • allanallan Posts: 65,206Questions: 1Answers: 10,804 Site admin

    Hi,

    What version of ColumnControl are you using there? My guess would be that you aren't on 1.1 yet, which was the version that introduced support for server-side processing.

    With 1.1 the columns objects are augmented with a columnControl parameter which contains information about the search term to apply. Full details are available here.

    See also this example to see ColumnControl search with server-side processing in action.

    Allan

Sign In or Register to comment.