Custom condition on specific field

Custom condition on specific field

gianlniccgianlnicc Posts: 2Questions: 1Answers: 0

Hello all,
I'm developing a webapp using django and django-restframework-datatable, no problem at all managing table with a simple global search. I tried to add searchbuilder extension (serverside) and have partial succes.
My problems are:
1) No selectable value in dropdown for string and number condition
2) No calendar object apper for date field

My question is basically related to point number 1 and is:
- can I have a custom condition on field, I mean can I have different custom condition for each field?

Not able to find answer myself in the manual and also in the forum didicated to searchbuilder

tnks

Answers

  • kthorngrenkthorngren Posts: 21,338Questions: 26Answers: 4,954
    edited October 2023

    1) No selectable value in dropdown for string and number condition

    The SearchBuilder server side processing docs state this:

    There are two caveats that SearchBuilder's server-side integration carries. The first is that anywhere select elements would normally be used on the client-side, input elements are used instead. This reduces strain on the server significantly, drastically improving performance.

    can I have a custom condition on field, I mean can I have different custom condition for each field?

    Also in the docs:

    The second is that custom conditions are not supported as these would require a custom server-side condition rather than one that can be used on the client side.

    I believe the django-restframework-datatable library examples implement server side processing. not sure if its required for that library to work. Possibly you don't need to use server side processing and can turn it off to get these features. See the Processing modes docs for more details.

    2) No calendar object apper for date field

    My guess is the date format is not recognized by SearchBuilder. You may need to use moment.js as shown in this example or Luxon as shown in this example.

    Kevin

  • gianlniccgianlnicc Posts: 2Questions: 1Answers: 0

    Thnaks for the reply.
    I don't understand very well this part:

    The second is that custom conditions are not supported as these would require a custom server-side condition rather than one that can be used on the client side.

    This mean that there's no corresponding https://datatables.net/extensions/searchpanes/examples/customFiltering/customOptionConditions.html

    in search builder?

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Yes, SearchBuilder can be extended as shown in this example.

    That is client-side though - so if you are using server-side processing, your server-side scripts would need to be modified for the custom conditions as well.

    Allan

  • teresaharristeresaharris Posts: 1Questions: 0Answers: 0

    The behavior you're describing, where there are no selectable values in the dropdown for string and number conditions, might be due to a configuration issue or an inconsistency in the way you've set up the SearchBuilder extension. You should ensure that you've configured your DataTable properly to handle string and number conditions. Double-check your code to ensure that you've included the necessary options for these conditions.

  • kthorngrenkthorngren Posts: 21,338Questions: 26Answers: 4,954

    @teresaharris and @hashirshabbir please see the SearchBuilder server side processing docs. As mentioned above the docs state this:

    There are two caveats that SearchBuilder's server-side integration carries. The first is that anywhere select elements would normally be used on the client-side, input elements are used instead. This reduces strain on the server significantly, drastically improving performance.

    Kevin

Sign In or Register to comment.