requested unknow parameter '...' for row 0

requested unknow parameter '...' for row 0

stefan.badaraustefan.badarau Posts: 7Questions: 1Answers: 1

here is the url: www.fagure.eu/CS
Ive added a column in the example table and I cant make it showing in the page...
If you need the code from the page, I can provide it.
Thank you

This question has an accepted answers - jump to answer

Answers

  • stefan.badaraustefan.badarau Posts: 7Questions: 1Answers: 1

    here is the database

  • allanallan Posts: 63,352Questions: 1Answers: 10,444 Site admin

    In your Javascript you have the following for column index 2:

    { "data": "01072016" },

    But there is no 01072016 field in your JSON data object for each row:

    {
        "rank": "2",
        "company_name": "3",
        "industries": "3",
        "fiscal_year": "2015",
        "employees": "2",
        "headquarters": "1",
        "functions": "<div class=\"function_buttons\"><ul><li class=\"function_edit\"><a data-id=\"1\" data-name=\"3\"><span>Edit<\/span><\/a><\/li><li class=\"function_delete\"><a data-id=\"1\" data-name=\"3\"><span>Delete<\/span><\/a><\/li><\/ul><\/div>"
    }
    

    Hence the error.

    Were you expecting 01072016 to be in the data object?

    Allan

  • stefan.badaraustefan.badarau Posts: 7Questions: 1Answers: 1

    Well, I'm a newbie. I just want to make working this for my purpose... I searched over the internet and still I don't know what should I modify :). How can I add in JSON data object the new column?

  • allanallan Posts: 63,352Questions: 1Answers: 10,444 Site admin

    I've no idea - what is currently generating your JSON? As I say, did you expect that property to be there? If so why? If you aren't expecting it to be there, why use it as a column data source?

    Allan

  • stefan.badaraustefan.badarau Posts: 7Questions: 1Answers: 1

    Hello again! :)
    i finnaly get a connection and a view of my records from the mysql:
    http://fagure.eu/CS/DT/examples/server_side/jsonp.html
    But i dont undestand why the search cant find "miere" if i search "iere" for example...

  • allanallan Posts: 63,352Questions: 1Answers: 10,444 Site admin

    Its using server-side processing, so your jsonp.php script it what needs to do the filtering. You would typically only need server-side processing if you have tens of thousands of rows in the table.

    Allan

  • stefan.badaraustefan.badarau Posts: 7Questions: 1Answers: 1

    but i have:

        $(document).ready(function() {
                $('#CaietStupina').DataTable( {
                    "processing": true,
                    "serverSide": true,
                    "ajax": {
                        "url": "caiet-stupina-data.php",
                        type: "post",
                            }
                } );
        } );
    
  • allanallan Posts: 63,352Questions: 1Answers: 10,444 Site admin

    Thanks for the code. As I said above, since you are using server-side processing, your script (caiet-stupina-data.php) is what needs to do the filtering. Does it currently have any code in it to do the filtering?

    Allan

  • stefan.badaraustefan.badarau Posts: 7Questions: 1Answers: 1

    it contains something like this:

    $sql = "SELECT nr_stup, poz_camion, ...... ";
    $sql.=" FROM caiet WHERE 1=1";
    if( !empty($requestData['search']['value']) ) { // if there is a search parameter, $requestData['search']['value'] contains search parameter
    $sql.=" AND ( nr_stup LIKE '".$requestData['search']['value']."%' ";
    .........
    $sql.=" OR 7mai16 LIKE '".$requestData['search']['value']."%' )";
    }

  • stefan.badaraustefan.badarau Posts: 7Questions: 1Answers: 1
    Answer ✓

    i figured out: it needs a % before requestData also:

    $sql.=" AND ( nr_stup LIKE '%".$requestData['search']['value']."%' ";

This discussion has been closed.