Not able to create new records with custom PK value #51

Open
matthew-marchetti opened this Issue Mar 10, 2016 · 2 comments

Projects

None yet

3 participants

@matthew-marchetti
Contributor

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.

@skyronic
Owner

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.

@fncapps
fncapps commented Apr 15, 2016

I'm also interested on this feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment