As of now, we have a list of people as a node for each person in jcr. We are trying to get all the people names in a drop-down using a servlet.
But, we can also create a node with a property holding the all the names as a json and call the property value in node instead of calling a servlet every time when we use it.
Also, I need to update the JSON value in this node whenever a new name added or existing name deleted.
I'm not sure about which approach I need to implement. servlet or creating a node that hold names.
Please suggest with pros and cons.
,
Views
Replies
Total Likes
Where are you trying to display the list - in an AEM component displayed in a web page? Or a component dialog Select field? Please provide more details.
Views
Replies
Total Likes
If you are trying to display the list in a Granite Select Field - then you can populate it with child nodes.
Views
Replies
Total Likes
We are trying to display in component dialog select field
Views
Replies
Total Likes
Follow this:
Here is an example procudure to add a Select field to an existing Touch UI Dialog and populate it with nodes - as shown above:
Perform these tasks:
1 Select the node at:
/apps/Lab2018/components/content/firstcomponent/cq:dialog/content/items/herotext/items/column/items.
• Name: type
• Type: nt:unstructured
• fieldDescription (String) - Select Size
• name (String) - ./size (you reference this value to read this value of this component field)
• sling:resourceType (String) - granite/ui/components/coral/foundation/form/select
/apps/Lab2018/components/content/firstcomponent/cq:dialog/content/items/herotext/items/column/items/type.
• Name: items
• Type: nt:unstructured
/apps/Lab2018/components/content/firstcomponent/cq:dialog/content/items/herotext/items/column/items/type/items.
• Name: small
• Type: nt:unstructured
• text (String) - small
• value (String) – small
• Name: medium
• Type: nt:unstructured
12 Add the following properties to the medium node:
• text (String) - medium
• value (String) – medium
• Name: large
• Type: nt:unstructured
15 Add the following properties to the large node:
• text (String) - large
• value (String) - large
Views
Replies
Total Likes
Hi,
Just a thought.
In one of our implementations we had used the servlet approach.
Based on what you mentioned "But, we can also create a node with a property holding the all the names as a json....Also, I need to update the JSON value in this node whenever a new name added or existing name deleted".
So, to get all the names of users in json format in a node:
1] You are planning to write a listener that will be watching for any addition/deletion to the users area and update the json information in a node?
Probably this can also be done without much of a performance issue. Just that the logic needs to be in place to handle the incremental additions/deletions to the user list and any modifications.
Views
Replies
Total Likes
If you are trying to display the list in a component dialog then you need to write a servlet/datasource. It will automatically change values if you delete something from the nodes.
Views
Replies
Total Likes