Closed Vishni92 closed 2 years ago
you just need to add condition that [$Answer] has content to button appear.
{
"elmType": "button",
"customRowAction": {
"action": "defaultClick"
},
"txtContent": "Show more",
"attributes": {
"class": "sp-row-button"
},
"style": {
"display": "=if([$ShowMore] == 'Yes' && indexOf([$Answer]+';',';')>-1, 'block', 'none')",
"margin-bottom": "8px",
"color": "white",
"background-color": "#0077DB"
}
}
@aaclage
Thank you for your response. I try your code and it doesn't work well. That code also apply all the items
sn't work well. That code also apply all the items
Forgot to remove the validation [$ShowMore] == 'Yes', should only appear if has text.
=if([$ShowMore] == 'Yes' && indexOf([$Answer]+';',';')>-1, 'block', 'none')
If I add [$ShowMore] == 'Yes', it didn't appear any 'ShowMore' button even if text isn't empty.
When I add as =if([$ShowMore] == '' && indexOf([$Answer]+';',';')>-1, 'block', 'none')
it will appear 'ShowMore' button every item.
I meant
=if(indexOf([$Answer]+';',';')>0, 'block', 'none')
I use first item to add ShowMore contentes, but every item has that button when items are no contents in ShowMore.
=if(indexOf([$Answer]+';',';')>0, 'block', 'none')
this is same result
there is alway a answer with content the button will appear, what field should validate?
Yes, there is always Answer and some Answers has ShowMore filed contents. Some items have ShowMore details and some items hasn't.
ok ok now i understand the correct fields should be [$ShowMore]
=if(indexOf([$ShowMore]+';',';')>0, 'block', 'none')
It works for once and when I refreshed the page it didn't appear ShowMore button in any. I am so confusing
try to close all tabs and give a look in the formating if the condition continues there.
I change the browser and clear browser data. But I it didn't work. I have no idea what happened. But once it worked.
faq-accordion
How to disable the 'ShowMore' button when that text filed is empty? I want to display the 'ShowMore' button only if there are any contents. If there are no contents, disable the button.