I have a page with tabs for products and bookmarked products(custom object).
It would be great if the row action (bookmark) could be conditionally rendered based on the result of a subquery ie. if the product has been bookmarked by the current user
I currently use a product model that uses the result of a subquery to only retrieve Products that have not been bookmarked
You are correct that conditional rendering of row actions cannot be done on a subquery, but you can create a template on your row, and use the conditional rendering provided by our mustache syntax to show an icon (or really anything) if there are child records for that particular row.
That syntax would look like this.
{{#ChildRelationshipName}}Text or Html Code or Model Merge syntax {{/ChildRelationshipName}}
Hi Rob,
Sorry I don’t follow you. Are you able to provide an example?
Yup here is an example.
I have an account tab page where I want to show an Icon if there are contacts on the account.
- I add the contacts child relationship to my accounts model (Unless you want to show contact details, you don’t need to add any fields)
- On the Accounts table add a template field. With this sort of syntax in the template:
{{#Contacts}}
{{/Contacts}}
What this does is look at the row - and if there are contacts, the icon will be shown, if no contacts are there, nothing will be shown.
You can wrap the Div in a
- This produces a page that looks like this:
There you go…
Thanks Rob!
I didn’t see the Child Relationship Tab on the models all good now.
Cheers,
William
Hi Rob,
I have another question. Is it possible to run actions from template components using javascript? If so are you able to point me in the direction of some documentation or examples? I have searched but was not able to find anything relating to running actions from template components.
Cheers,
William
Ugh. Your subsequent question was rattling around my head when I wrote the prior answer. When you go to a template, you do lose the hooks into the action framework. You are now in the realm of a custom field renderer that uses the javascript API to show the icon conditionally, and then controls the actions that occur when that link is selected. Here is a community post sketching out this strategy: https://community.skuid.com/t/custom-popup
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.