ais-one/cookbook

Make defaultRec into store

santilin opened this issue · 2 comments

In the current implementation, defaultRec is a method or function inside crudForm, but sometimes, the default record must be got from the store. For example, if you have a 'code' field that must be set to the next available code in the resource or a date field that must be set to the last date used for that resource. For these examples to work, a call must be made to the backend to get de default record values.

I guess the place to program this call is in crudOps, but I am just a js and vue beginner.

Ok, I see what you mean, let me see if this can be done without breaking things

latest update from v0.1.7, many things are now customizable and you can access the component methods and properties even from a scoped slot.

You can choose to save defaultRec stuff into a store writing the code to do so.

Personally, I have reduced the use of Vuex from v0.1.8 as it is not necessary to use the store and reduces complexity and space usage (it was noted that each table component you create and the records read take up store space).