datatables 1.10 and YADCF - passing value in column to php script

datatables 1.10 and YADCF - passing value in column to php script

kathys2151kathys2151 Posts: 5Questions: 2Answers: 0

I'm using datatables 1.10 and YADCF to display the inventory of a client. This works perfectly as all my data comes up. I'm using server_side processing as there is a ton of data. My problem comes when an admin wants to see all their computers with 6mg of ram for instance. Currently, the user types in "6", and I'd like to have that value passed to the server_processing script which will run the mysql query. Here is how I am setting up my datatables:

        $(document).ready(function() {
             var oTable = $('#example').DataTable( {         
               "bProcessing": true,
              "bServerSide": true,
              "bFilter": false,
               "ajax":  {
                     "url": "scripts/server_processing.php",
                     "type" : "POST",
                     "data": {
                        "ram" : "ram" }                 // test
               },
               "sServerMethod" : "POST",
               "columns": [ 
                    {
                        "class":          "details-control",
                        "orderable":      false,
                        "data":           null,
                        "defaultContent": ""
                    },
                    { "data": "manu" },
                    { "data": "ram" },
                    { "data": "cpu" },
                    { "data": "location" },
               { "data": "room" },
                    { "data": "owner" }
                ],
            "order": [[1, 'asc']]
            });......

Then in server_processing.php, I try to grab the search parameter typed in by the user:

```php
$ram= $_POST['ram'];
``````

However, when I look in Firebug at the data passed, I don't see any value in [columns][1][search][value]

How do I pass the values a user types into the filter box that YADCF presents?

Also, this data resides on a client's internal LAN, so I cannot put a live system out for everyone to see.

This question has an accepted answers - jump to answer

Answers

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    Answer ✓

    Inspect your headers in firebug , and look where the search values are hiding... in my yadcf showcase it can be found in columns[0/1/2/etc...][search][value]

    maybe because of your columns": [.... usage it somewhere else (

    yadcf using the datatables platform for passing all those info to server.

  • kathys2151kathys2151 Posts: 5Questions: 2Answers: 0

    I will go check that. Thank you.

This discussion has been closed.