Problem With Datatables Editor Generator
Problem With Datatables Editor Generator
Just downloaded the trial of this, but am struggling a bit.
As an initial test, i used the default data, connected to the 'users' table and used the primary key field and three others.
Downloaded the complete package - it works
I then connected to one of my own tables, tblcoupons, currently working ok with datatables
The package was created in the same way, but when I load the page, I get an error
SQLSTATE[42S22] 1054 Unknown column 'id' in 'field list'
The primary key is not called 'id' it is CouponID, and I used this in the generator.
There is no field with this name in the table, but cant see why it is being referenced
I searched for 'id' in the downloaded pages but can;t find it
This question has an accepted answers - jump to answer
Answers
Hi,
Sorry for the problems. I'll take a look into the Generator issue, but for the moment, if you open the PHP file that Generator creates and edit the line
Editor::inst(...)
. Theinst()
function should be given three parameters when you want to use a primary key that is notid
. The third parameter tells Editor what to use - in this case you want something like:Regards,
Allan
Thats it, I added the third parameter corresponing to the PK, and the data now loads successfully
Thanks
Another possible problem with the generator,
When I chose date as a field type, validation required, and left the default format, I got a parse error in my generated php
I got
->validator( 'Validate::dateFormat, array( 'empty' => false )', 'D, j M y' )
->getFormatter( 'Format::date_sql_to_format', 'D, j M y' )
->setFormatter( 'Format::date_format_to_sql', 'D, j M y' ),
instead of
->validator( 'Validate::dateFormat', 'D, d M y' )
->getFormatter( 'Format::date_sql_to_format', 'D, d M y' )
->setFormatter( 'Format::date_format_to_sql', 'D, d M y' ),
Thanks for pointing that out. I'll take a look at it very shortly.
Allan