I have sections belons to classes so when I chosse one class it should only shows related classes
I've tried using laravel nova package but it doesn't work so so i want to do it manualy
which packages did you test? have you test this one?
nova-belongsto-depend
Related
I'm working with Grails 3.3.9 but I can change that as necessary.
I would like to let the Grails fields plugin manage my CRUD as generated, or at least with minimal manual changes. The problem I have not been able to solve is when I have a many-to-many relationship and want to show the related instances from either side.
A simple example: two domain classes, Company and Worker. Each have a String name and each have a hasMany:
static hasMany = [companies: Company] // in Worker
static hasMany = [workers: Worker] // in Company
I don't identify that either class belongsTo the other.
When I generate-all and run the app, then use Worker / new CRUD to create new instances of Worker, all seems fine.
Then, when I create a company using Company / new CRUD, I am offered a drop-down of the already defined workers, which looks good; so I shift-click on a couple to include them in the new company definition. But then after the save, the show CRUD does not show a list of selected workers for the Company instance I just created. There is a field label "Workers" but no value shown next to it.
I can't seem to find any obvious way to encourage f:display to show that list - or maybe somehow the multi-select didn't produce the desired results.
Yes it can. Solved my problem. This page:
https://github.com/grails-fields-plugin/grails-fields/blob/master/grails-app/views/templates/_fields/_list.gsp
shows what the template is (should be?) to render fields. Wondering if that was somehow different than what's in my version, I installed that file in
...grails-app/views/templates/_fields/_list.gsp
and suddenly my many-to-many relations were visible.
Extra info that may be useful for others stumbling over this:
I followed the GORM reference manual recommendation for creating a many-to-many relationship where each side includes a
static hasMany = [...]
and the "owned" side also has a
static belongsTo =
I think I may have been confused as to the meaning of the belongsTo in this case - what it means is well explained here:
http://docs.grails.org/3.0.4/guide/GORM.html#manyToMany
I would like to add a new column with some static values like buttons and links to an existing tag in a view.
Is this possible? In the documentation, I can only find how to add or removes attributes that are part of the domain class. There doesn't seem to be a way to add a column with custom values. Ex: a button with a link to the "show" view and so on.
Looks like (unfortunately) there isn't a standard Grails way to do this.
I did manage to do this by using tables and loops ... to run the loop and then displaying the values using Grails variables. It would be great though if there was a standard Grails way to do this as it seems to be waste to first use a framework and then discard the scaffolding to write your own custom table!
Is there a way to add my own auto generated field to domain like id and version , If yes the please guide me . provide me URL form where i can read and under stand the core concept of Grails and Domain specific language .
use install-template in the app to get all default templates:
grails install-template
after which you would be able to see /src/templates (newly created)
Modify DomainClass.groovy under /src/templates/artifacts as below:
#artifact.package#class #artifact.name# {
//according to your need
Long myId
Integer myVersion
static constraints = {
}
}
Done!!!!
Henceforth, when create-domain-class command is used to create a domain class, those fields will be auto populated.
I am not sure I am understanding your question correctly but here is the link to the web features of Grails documentation. The "Link Generation API" may be something you are asking after.
If you would like to manage ID and version than using Spring Security (plugin or full docs) or SQL features may be the direction you want to read more about.
EDIT: Try this Stackoverflow question and answer on using inheritance. Seems to be very similar to what you are asking.
You would need to write an AST transform to inject the fields you want to add automatically. The one that injects ‘id’ and ‘version’ can be found here as an example:
https://github.com/grails/grails-core/blob/master/grails-core/src/main/groovy/org/codehaus/groovy/grails/compiler/injection/DefaultGrailsDomainClassInjector.java
You would then need to write a GORM event listener to automatically update the values of these properties. See
https://github.com/grails/grails-data-mapping/blob/master/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/events/AutoTimestampEventListener.java
For an example of the one that updates the dateCreated/lastUpdated properties.
These can both be written in a separate Gradle/Maven project which you then reference in the dependencies of your BuildConfig.groovy file.
I use grails 1.3.7. I have a class A which has a one to one relation to class B. By default, the static scaffolding generate a <g:select> component to manage this relation on Class A referential screen.
But I have plenty instance of Class B so when I try to expend the component, my navigator freezes (I try to load all the class B instance I think) !
One solution could be to Ajax-ify my component and made a kind of pajinated request but I think there is a easier way (another strategy, component ?)
Do someone have any idea on this issue ?
Also the best would be to have a component where the user can also filter the Class B component with it's attributes. Not sure it already exists in grails ...
Use Jquery's Autocomplete or typeAhead of Twitter bootstrap.
I'm using Entity Framework (.net)
We have various departments and One table with different table names has same schema across all departments. like if Department Name is ABC and DEF the table name is ABC_TimeSeries and DEF_Timeseries respectively.
I have created a one class. Now I would like to change the tables name as user selects the department using drop-down selection box.
In your case that you have suffixes, I think Brandon Haynes solution -Entity Framework Runtime Model Adapter- can help.
But I'm going to use interfaces and dependency injection for my similar problem.