crudkit icon indicating copy to clipboard operation
crudkit copied to clipboard

Not able to create new records with custom PK value

Open matthew-marchetti opened this issue 9 years ago • 2 comments

When trying to add a new record to the db using mysql and setting the primary value with ->setPrimaryColumn() - I'm not able to create a new record with a custom Primary key. The value simply does not display for me in the create form and defaults to 0 when the record is created.

Trying to add the same column in with the ->addColumn () to display in the create form causes the first table only not to load with this error: TypeError: Cannot read property 'key' of undefined at crudkit.min.js:768 at crudkit.min.js:264 at n.$eval (crudkit.min.js:278) at n.$digest (crudkit.min.js:275) at n.$apply (crudkit.min.js:279) at l (crudkit.min.js:233) at F (crudkit.min.js:237) at XMLHttpRequest.C.onload (crudkit.min.js:238)

The main part of this method is $scope.primaryCol = _.find (colSpec.schema, 'primaryFlag', true).key;

When using the paginated bar - the other tables load without issue. Only the first table fails - i see they use different methods.

Users should be able to create a new record with the form while adding their own Primary key.

matthew-marchetti avatar Mar 10 '16 17:03 matthew-marchetti

Oh. I haven't tested creation of records with custom PK.

I'll definitely look into it this week. It might be a few changes. Thanks for pointing this out.

skyronic avatar Mar 12 '16 17:03 skyronic

I'm also interested on this feature!

fncapps avatar Apr 15 '16 08:04 fncapps