Requested unknown parameter '{parameter}' for row
Requested unknown parameter '{parameter}' for row
I run into a strange Problem with Datatables Editor (V1.9.5):
Here are my Codes:
ServerSide:
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
Editor::inst( $db, 'pages' )
->fields(
Field::inst( 'pages.id' ),
Field::inst( 'pages.pagename' )->validator( 'Validate::notEmpty' ),
Field::inst( 'pages.db' )->validator( 'Validate::notEmpty' ),
Field::inst( 'pages.pagetype' )
->options( Options::inst()
->table( 'pages_typ' )
->value( 'id' )
->label( 'typ' )
)
->validator( 'Validate::dbValues' ),
Field::inst( 'pages.pagelevel' )
->options( Options::inst()
->table( 'pages_level' )
->value( 'id' )
->label( 'level' )
)
->validator( 'Validate::dbValues' ),
Field::inst( 'pages.bemerkung' ),
Field::inst( 'pages.pageheadline' ),
Field::inst( 'pages.pagesubheadline' )
)
->leftJoin( 'pages_typ', 'pages_typ.id', '=', 'pages.pagetype' )
->leftJoin( 'pages_level', 'pages_level.id', '=', 'pages.pagelevel' )
->process( $_POST )
->json();
Field Settings:
"fields": [ {
"label": "Id:",
"name": "pages.id"
}, {
"label": "Pagename:",
"name": "pages.pagename"
},{
"label": "Db:",
"name": "pages.db"
},{
"label": "Pagetype:",
"name": "pages.pagetype",
"type": "select"
},{
"label": "Pagelevel:",
"name": "pages.pagelevel",
"type": "select"
},{
"label": "Bemerkung:",
"name": "pages.bemerkung"
},{
"label": "Pageheadline:",
"name": "pages.pageheadline"
},{
"label": "Subheadline:",
"name": "pages.pagesubheadline"
}
]
Columns (data) Setting:
columns: [
{ data: "pages.id" },
{ data: "pages.pagename" },
{ data: "pages.db" },
{ data: "pages_typ.typ", editField: "pages.pagetype"},
{ data: "pages_level.level", editField: "pages.pagelevel"},
{ data: "pages.bemerkung" },
{ data: "pages.pageheadline" },
{ data: "pages.pagesubheadline" }
],
Error Message:
DataTables warning: table id=dttable - Requested unknown parameter 'pages_typ.typ' for row 0, column 3. For more information about this error, please see http://datatables.net/tn/4
Now here it comes:
After the warning Message the table shows up. But the two left Joined Fields (SELECT) missing (empty field). But wenn i click into the field or i select whole row for editing it maps correct with the correspondig information from the joined Table.
Hint:
I noticed while observing the json stream that there seems to be missing the joined Table in the "data Object". There is only "pages". While in the "option Object" the joined Table are present. Thats why the SELECT function works correct while editing, but it dont show the correct data in the table itself.
I use php 7.4, Apache 2.4, newest pdo_mysql
Editor: 1.9.5
Datatables: 1.10.22
jquery: 3.3.1
Bootstrap: 4.1.1
thanks in advance
Andreas
This question has an accepted answers - jump to answer
Answers
Hi Andreas,
Thanks for your question. It looks like you don't have a
pages_typ.typ
property in the data being returned from the server. Should it bepages.pagetype
? Or ispages_typ.typ
missing from your fields in your PHP script?Allan
Cant see an error. Because he maps the types and levels in my data correct when i try to EDIT in the Table.
so my server side script seems to reads the Mysql Data correct.
Here is my Table Structure:
Main Table
Corresponding Tables
No complex thing on the first view. Seems to be a stupid error on my side or misunderstanding. But no way to find the error.
My json Stream......and my guess of missing data in the first objekt
Thanks for the extra information. The first thing you'll need to do is read the label (
typ
column) from your left joined table:Then in your DataTable columns use:
which is what you have done.
Similarly, you'll need to read from the left joined table for the pages_level:
That I think should do it.
Allan
Perfect.
Thats the trick. Did not know (realize) that i can read from multiple tables in the same editor instance ($db). Now the json data is complete and shows the correct table with the left joined data.
Many thanks. You did a great job with this tool. I love it creating little Frontends quick an dirty for handeling data without the need of things like phpmyadmin or else.
thumb up
Thank you - great to hear you got it working!
Allan