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!
Related
I am having one document type which contains a dropdown list, I need to add a couple of things in it:
I need to display the Database table names in drop-down dynamically.
On the change of dropdown option, i need to display the selected table columns names in another drop-down.
Are above things possible by using only existing data types or it will require creating a custom template using razor syntaxes (if it is so then how the template will display directly in the back office content node?)
Can you please provide your views and any links for code/tutorials?
screen shot of content form
If this is for the back office, you will need to do it in HTML and Angular, with an API controller to handle the DB lookup stuff.
As far as I'm aware, there's nothing built in to do dropdowns that depend on each other, so you'd have to create a new DataType to do it.
The process is to long to detail here, but here are some useful links on creating custom DocTypes in Umbraco 7.
https://our.umbraco.org/documentation/tutorials/Creating-a-Property-Editor/
http://velstand.info/tips/umbraco/to-create-a-datatype-by-using-external-data-sources/
https://24days.in/umbraco-cms/2016/custom-property-editor-tutorial/
I'm quite new to Rails development and I came up with this question today. I have a method that returns some JSON data.
It is used to populate a select with a list of cities according to what was selected on a previous select (list of states). So, it's a simple method that loads a list based on some ajax parameter passed through and it is used all along my site.
I'm using Rails 4 and I placed this method on my HomeController. So everytime I need to fetch the list of cities, I call the HomeController to load the data.
Is this the correct approach or should I place this method on a more generic controller (like ApplicationController)? Is there a better way?
I think the best thing is to keep this modular. So you can create a separate controller for this, like StatesController - and possibly even a separate model if that makes sense for your application (I'm not sure where you're getting your data). There is no cost to having extra controllers, and this way your code is clean and organized, with each piece of functionality existing in its logical place.
I use MvxActionBasedTableViewSource for my custom binding on common grids.
Func CellCreator is really great and everything works fine with that.
But. What way is it expected to deal with groupped tables?
I need some dynamic binding with them.
So, does that mean that I should implement that logic by my own and CellCreator can not be used for such behaviour anyhow?
Thanks!
MvxActionBasedTableViewSource is designed for simple tables only - so cannot be used for grouping without some changes - e.g. via inheritance or copy and paste.
For a list of available TableViewSources, see What class to inherit from for bound table source
For an example of grouping, see Creating UITable with section using Mono touch and slodge mvvmcross (the code is out of date, but the principles are still the same)
I'm using a code first approach to a simple web application: currently just a single table of book reviews.
I modified the model to include an extra column ("Rating"), and I also have an initialiser which correctly rebuilds the database every time I change the schema.
The problem is that none of the CRUD Views are updated to reflect the new "Rating" column. Do I have to modify each View by hand, or is there a simpler way?
Yes, you have to manually add them. Scaffolding is intended for simple set up of views / controllers only.
I would like to have different views of a webpage depending on certain attributes of an item that I am showing.
This is: if the item is in the category X then I show some sections of the page. In other category I show others.
There is others attributes of the item.
I am aware of the multitenant plugin, but I think that is not what I am looking for.
I am thinking of something that maps a hierarchy of attributes with a particular grails view or layout. Maybe obtaining the name of the layout and view concatening the attributes some how to respect convention over configuration.
But I am concern in maintainability.
Can you give me any pointer?
You have a bunch of options
put the branching logic in a controller, and render different views based on the data
put the branching logic in a gsp, and simply don't render different parts based on the model passed into the gsp
You can make the code clean in either way by making use of templates, to stay DRY.