Getting the "Requested unknown parameter..." error

Getting the "Requested unknown parameter..." error

webpointzwebpointz Posts: 126Questions: 30Answers: 4
edited October 2015 in DataTables

I have a column in the datatable that should put a "Type Name" in for each row based on a "LeftJoin" that's being done in the JS file.

Editor::inst( $db, 'seh_kititems', 'id' )
    ->fields(

        Field::inst( 'seh_kititems.referenceid' ),
        Field::inst( 'seh_kititems.description' )
            ->validator( 'Validate::notEmpty' ),
        Field::inst( 'seh_kititems.type' )
                    ->options( 'seh_kititemtypes', 'id', 'name' )
                    ->validator( 'Validate::notEmpty' ),
            Field::inst( 'seh_kititems.quantity' ),
        Field::inst( 'seh_kititems.warning' )
    )

    ->leftJoin( 'seh_kititemtypes', 'seh_kititemtypes.id', '=', 'seh_kititems.type' )
    
    ->process( $_POST )
    ->json();

According to another table that works fine, I should see the following:

data:Array
  0: Object
  DT_RowId: "row_1"
seh_kititems: Object
seh_kititemtypes: Object

However, I only see the following:

data:Array
  0: Object
  DT_RowId: "row_1"
seh_kititems: Object

The error is "DataTables warning: table id=seh_kititems - Requested unknown parameter 'seh_kititemtypes.name' for row 0."
Any idea what I'm doing wrong?

Here is the JSON being returned:

{
    "data": [{
        "DT_RowId": "row_1",
        "seh_kititems": {
            "referenceid": "N-9560BT",
            "description": "Fingertip Pulse Oximeter",
            "type": "4",
            "quantity": "25",
            "warning": "0"
        }
    }, {
        "DT_RowId": "row_2",
        "seh_kititems": {
            "referenceid": "UA-UC-351PBT-CI",
            "description": "Precision Scale",
            "type": "2",
            "quantity": "25",
            "warning": "0"
        }
    }, {
        "DT_RowId": "row_3",
        "seh_kititems": {
            "referenceid": "UA-767PBT-CI",
            "description": "Upper Arm BP Monitor Blue Tooth",
            "type": "3",
            "quantity": "25",
            "warning": "0"
        }
    }],
    "options": {
        "seh_kititems.type": [{
            "value": "3",
            "label": "Blood Pressure Cuff"
        }, {
            "value": "7",
            "label": "Box"
        }, {
            "value": "8",
            "label": "Insert #1"
        }, {
            "value": "9",
            "label": "Insert #2"
        }, {
            "value": "10",
            "label": "Insert #3"
        }, {
            "value": "4",
            "label": "Oximeter"
        }, {
            "value": "2",
            "label": "Scale"
        }, {
            "value": "1",
            "label": "Tablet"
        }, {
            "value": "5",
            "label": "Tablet Charger Cord"
        }, {
            "value": "6",
            "label": "Tablet Charger Plug"
        }]
    }
}

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin
    Answer ✓

    It looks like you need to add a field that references the seh_kititemtypes table. You are joining against that table, but not pulling any data from it.

    Allan

  • webpointzwebpointz Posts: 126Questions: 30Answers: 4

    Hi Allan,

    Where abouts would I need to put a field that references this table?

  • webpointzwebpointz Posts: 126Questions: 30Answers: 4

    Got it, thanks!

This discussion has been closed.