Custom Search and predefined values

Custom Search and predefined values

tijanatijana Posts: 1Questions: 1Answers: 0
edited November 25 in SearchBuilder

I am using this script:

 <script type="text/javascript" SameSite=Strict

I am using Datatables and completely custom layout and everything (as customer required) for searching the table/orders.
Each column has related textbox in some custom dropdown.
When I enter text in textbox 1, which is related to a specific column 1, I save that text in database.
When I enter text in textbox 2, which is related to a specific column 2, I save that text in database as well.
It can be number, text, whatever, doesn't matter at the moment.

When I load the application again, I want to have that search text for specific column 1 loaded in textbox 1 and I want table to be filtered already.

Here is a part of my code, I have lots of events afterwards....

                //'sdom': 'Rlfrtip',
               ** dom: 'Qlfrtip',**
                select: true,
                'colReorder': {
                    'allowReorder': true
                "sAjaxSource": "/orderlines/GetData",
                "bServerSide": true,
                "bProcessing": true,
                "bSearchable": true,
                "scrollX": true,
                orderCellsTop: true,
                scrollY: $(window).innerHeight() - $(".dataTables_scrollHead").height() - $(".list-toolbar").height() - $(".topbar").height() - 30,
                deferRender: true,
               ** searchBuilder: {
                    preDefined: {
                        criteria: [
                                condition: '=',
                                data: 'OrderId',
                                type: 'num',
                                value: [56]
                scroller: {
                    displayBuffer: 10,
                    boundaryScale: 0.75

SO, when the table is loaded and I wanted to see only orders with orderId = 56, nothing actually happens (it is not filtered at all), here is what the ajax is sending to backend [Notice the last bold attributes/parameters]:


I hope my explanation is clear.

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


  • colincolin Posts: 12,877Questions: 0Answers: 2,198

    That looks like it should work as the layout looks similar to this example. Are you able to link to your page, or create a test case with that format, please, so we can take a look. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    It's also worth noting that stateSave does deal with remembering the last selections - see example here. Would that work instead?



Sign In or Register to comment.