URGENT - Problems getting server side processing to work with Individual column searching

URGENT - Problems getting server side processing to work with Individual column searching

egrysegrys Posts: 4Questions: 2Answers: 0

Does anyone have a solution to get Individual column searching (select inputs) working with server side processing? I have a mysql database with 5.4 million records... https://teknowlage.com/voter/voter_report.php
For obvious reasons,, I only need City, Party, 2016G, 2018P, and 2018P columns to use dropdowns.

Thanks, Ed

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    This example here demonstrates that.

    Colin

  • kthorngrenkthorngren Posts: 20,275Questions: 26Answers: 4,765

    Taking a look at the XHR request and response it looks like your web page is sending a regex search request:

    When choosing "ADAMS" in the Last Name column it sends ^ADAMS$ as a regex search. Then your server script responds with the original data so it never changes.

    The column search is the responsibility of your server script. Are you using a Datatables supplied script?

    Maybe turn off regex searching when using column().search().

    Kevin

  • egrysegrys Posts: 4Questions: 2Answers: 0

    We are still experiencing problems getting "filter by" fields to process correctly.

    Any help would be greatly appreciated. Ed

    https://teknowlage.com/voter/voter_report.php

    Our voter_server_processor.php has the following code for city...

    Read value

    $draw = $_POST['draw']; $row = $_POST['start'];
    $rowperpage = $_POST['length']; // Rows display per page
    $columnIndex = $_POST['order'][0]['column']; // Column index
    $columnName = $_POST['columns'][$columnIndex]['data']; // Column name
    $columnSortOrder = $_POST['order'][0]['dir']; // asc or desc
    $searchValue = htmlentities($_POST['search']['value']); // Search value

    Search

    $searchQuery = " ";
    if($searchValue != ""){
    $searchQuery = " and (id like '%".$searchValue."%' or
    name_last like '%".$searchValue."%' or
    city like '%".$searchValue."%' or
    party like '%".$searchValue."%' or
    2016G like '%".$searchValue."%' or
    2018P like '%".$searchValue."%' or
    2018G like'%".$searchValue."%' ) ";
    }

    $columnNameCity = $columnIndex;

    if($searchValue == "" && $columnNameCity == 'city'){
    $Citysearchvalue = htmlentities($_POST['filterby']['value']); // Search value
    // $Citysearchvalue = htmlentities($_POST['columns'][3]['value']); // Search value
    $searchQuery = " and (id like '%".$searchValue."%' or
    name_last like '%".$searchValue."%' or
    city like '%".$Citysearchvalue."%' or
    party like '%".$searchValue."%' or
    2016G like '%".$searchValue."%' or
    2018P like '%".$searchValue."%' or
    2018G like'%".$searchValue."%' ) ";
    }

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    Did you try Kevin's suggestions?

    Colin

  • egrysegrys Posts: 4Questions: 2Answers: 0

    Yes Colin... Finally got it working...

    https://teknowlage.com/voter/voter_report_new.php running slow because of the 5.4 Million records... Will need to work on optimization...

    In the next phase, I plan to put in a couple of dropdowns...

    Thank you for your help... I you have any suggestions, please pass them along...

    • Ed
This discussion has been closed.