Editor 1.2.4 change Name of Primary Key
Editor 1.2.4 change Name of Primary Key
Hi,
I got a problem with my tables and the Primary key name id.
I want use my own Primary key field called customers_id instead of id
in Old Editor i do that and it works but not in 1.2.4 anymore.
$editor = new DTEditor(
$db, // DB resource
'customers', // DB table
'customers_id', // Primary key
'row_', // ID prefix to add to the TR rows (makes it valid and unique)
array( // Fields
new DTField( array(.......
Where i can change it?
that do not work in 1.2.4
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'customers', 'customers_id' )
->fields(........
thnak you
Markus
I got a problem with my tables and the Primary key name id.
I want use my own Primary key field called customers_id instead of id
in Old Editor i do that and it works but not in 1.2.4 anymore.
$editor = new DTEditor(
$db, // DB resource
'customers', // DB table
'customers_id', // Primary key
'row_', // ID prefix to add to the TR rows (makes it valid and unique)
array( // Fields
new DTField( array(.......
Where i can change it?
that do not work in 1.2.4
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'customers', 'customers_id' )
->fields(........
thnak you
Markus
This discussion has been closed.
Replies
There is also a `pkey()` function for this Editor class you could try:
[code]
Editor::inst( $db, 'customers' )
->pkey( 'customers_id' )
...
[/code]
Allan
again the same issue when i use that
Editor::inst( $db, 'customers', 'customers_id' )
OR
Editor::inst( $db, 'customers' )
->pkey( 'customers_id' )
{"id":-1,"error":"","fieldErrors":[],"data":[],"aaData":[{"DT_RowId":"row_1","customers_id":"1","bpn_id":"900100","entry_company":"test GmbH & Co. KG","entry_gender":"m","entry_firstname":"Markus"....
php works but json send again the id field.
[code]
"DT_RowId":"row_1",
"customers_id":"1"
[/code]
The primary key is used in the `DT_RowId` property with `row_` prefixed to make it valid for use in the DOM. The number used is that of the `customers_id` which you has specified as the primary key.
Is that not what you were expecting?
Thanks,
Allan