Hide a Menu Link based on a Count of Connections to a Table #222
-
Hi all, Hopefully screenshot below shows what I'm trying to do - would like to hide a menu link based on a count of connections For this example would like to hide the menu link to 'Sites' if the count of connections between company and sites is zero Am trying to use the ktlCond as below with a jQuery - have identified the class of object as .kn-MenuLink (??) and this was my attempt _hf=[Sites],[ktlCond, is, 0, Sites Count,Counts] $('#view_4049.kn-MenuLink:data-menu-link-count=2') I think just something wrong with the jQuery selectorString - little help? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
I can see the confusion. It's not very obvious when you start to use the KTL at first. Here's what you need to add to the Counts details view:
Add class ktlHidden to the jQuery target if Sites Count has a value of zero. Let me know if it works, |
Beta Was this translation helpful? Give feedback.
-
Thank you I'm starting to get it - that didnt work though there was a little typo in your code, but that wasnt the problem - corrected that here
heres a link to example page: https://greenlightservices.knack.com/greenlight-online#companies4/view-company2/65c41a145009110027ea2920/ |
Beta Was this translation helpful? Give feedback.
-
I tried your application directly and found the issue. The ktlTarget wasn't quite good. Here's the updated string:
I also replaced is by equ, which is recommended when comparing numeric values (vs strings). I've seen it work, so you should be good to go now. Norm |
Beta Was this translation helpful? Give feedback.
-
I still couldn'tget it tow work :( I got this in the java console
|
Beta Was this translation helpful? Give feedback.
-
Hi Michael, I could now reproduce your problem. It is due to the keyword parser that doesn't handle the square brackets in a jQuery selector. Craig has the same issue. In the meantime, I've got another options for you.
Going back to your original version above with the "equates 0" compare, you end up with this:
Give it a try, |
Beta Was this translation helpful? Give feedback.
-
Works !! Fantastic thank you so much |
Beta Was this translation helpful? Give feedback.
-
And by the by I could see this use being a useful application for people generally some variations might be
|
Beta Was this translation helpful? Give feedback.
Hi Michael,
I could now reproduce your problem. It is due to the keyword parser that doesn't handle the square brackets in a jQuery selector.
See issue #220 and my reply here: #220 (comment)
Craig has the same issue.
A fix for this may take a few days.
In the meantime, I've got another options for you.
Going back to your original version above with the "equates 0" compare, you end up with this:
_cls=[ktlHidden], [ktl…