Hide Elements By Value #90
Replies: 16 comments 11 replies
-
Hi Craig, Thanks for sharing that code. I am very impressed at your initiative and talent with the KTL ! Now, I have a few questions:
BTW, about my question #3 (commas), I'd like to point out that the KTL Options have this very special advantage: when they are parsed, the whole string that follows the option is left intact, including commas, spaces, quotes and everything. This design strategy allows the keyword's own "secondary" parser to decide if that string must be split again, or used as a whole - as in a jQuery selector for example. By curiosity... did you come up with this function because the _cfv keyword wouldn't allow achieving your goal? It seems to me that everything was already in _cfv, unless I'm missing something. Can you try these two lines in your view and tell me if does what you want please?
I'd love to add your function in the KTL, but I need to be sure we're not duplicating things. Let me know, |
Beta Was this translation helpful? Give feedback.
-
Hi Norm
Thank you for the feedback.
You are right the border last radius should be removed we have it for when
we hide menu links and the menu link we hide is the last one in the list.
It just gives the menu a slightly curved end.
This will hide anything based on a list or details view.
I didn't realise the cfv could hide elements I will give it a go and get
back to you.
Craig
|
Beta Was this translation helpful? Give feedback.
-
Hi Norm Thanks for letting me know about the _cfv. The _cfv works for this. Craig |
Beta Was this translation helpful? Give feedback.
-
Well I feel a bit sad for all the efforts you've invested in this, but at the same time, I am very happy to see that someone has mastered the keyword creation principles, the multiple instances, and the keyword options. You should be very proud. You've learned some important parts of the KTL structure and you're now ready to become a contributor. Can't wait to see what else you will come up with !! Cheers, |
Beta Was this translation helpful? Give feedback.
-
Well we initially did the function before you had cfv then today we added
roles and multiple instances. We learned quite a bit from doing that so
nothing was lost.
…On Fri, 18 Aug 2023, 17:00 Cortex R&D Inc., ***@***.***> wrote:
Well I feel a bit sad for all the efforts you've invested in this, but at
the same time, I am very happy to see that someone has mastered the keyword
creation principles, the multiple instances, and the keyword options.
You should be very proud. You've learned some important parts of the KTL
structure and you're now ready to become a contributor.
Can't wait to see what else you will come up with !!
Cheers,
Norm
—
Reply to this email directly, view it on GitHub
<#90 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACQQXA7UQUCDZIYCLWDGOTTXV6GQ5ANCNFSM6AAAAAA3VLI5QE>
.
You are receiving this because you authored the thread.Message ID:
<cortexrd/Knack-Toolkit-Library/repo-discussions/90/comments/6763090@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Hi Norm I've tried to replace another _hebv with the this:
This one doesn't seem to work though. Any ideas? Craig |
Beta Was this translation helpful? Give feedback.
-
Hi Craig, You're right, thanks for reporting. I've fixed the jQuery validator by simply testing if the selector finds something. This should work all the time. You can pull the dev branch and test. If all ok, I'll do an official release. Norm |
Beta Was this translation helpful? Give feedback.
-
Hi Norm Just to avoid confusion as I think I have flip flopped a couple of times. The doesn't work I have tried it with false and I get a length of 1 for the jQuery selector. I tried to put the _cfv in the details view where field_5062 is (in case it was a rendering order issue) and I got this error: I normally put it in the menu view Type. I hope that makes it clearer and where I am now. |
Beta Was this translation helpful? Give feedback.
-
I know exactly what the problem is, but this will require a bit of design changes.
This is due to the asynchronous rendering of views. You ask for a selector that point to an element that does not yet exist. Quite complex changes... for a Saturday!!! Will try to come up with a nice solution. Norm |
Beta Was this translation helpful? Give feedback.
-
Hi Craig, If you have the chance to test the latest push on the dev branch, I'd appreciate your feedback. Here are the details on this. Before: Now: As you can see, the jQuery string must be enclosed in a typical full syntax starting with this: and ending with this: The quotes can also be double quotes. Both are supported, but not escaped characters like \' or \". When the code detects this syntax, it will strip the first 3 and last 2 characters, and this resulting string will become the actual jQuery: $('resultingString') See function This solves any possible ambiguity while trying to detect jQuery, and works perfectly in all scenarios. I should push the official release tomorrow, if you can confirm that all works well on your side. About your other questions, I will get back to you later. Cheers, |
Beta Was this translation helpful? Give feedback.
-
I will test when I get in thank you
…On Sun, 20 Aug 2023, 20:17 Cortex R&D Inc., ***@***.***> wrote:
Hi Craig,
If you have the chance to test the latest push on the *dev* branch, I'd
appreciate your feedback.
There are lots of major changes again, and some will *break* the existing
jQuery selectors in the *ktlTarget*.
Here are the details on this.
Before:
[ktlTarget, li.menu-links__list-item:contains("Prev. Stay Info")]
Now:
[ktlTarget, $('li.menu-links__list-item:contains("Prev. Stay Info")')]
As you can see, the jQuery string must be enclosed in a typical *full*
syntax starting with this:
$('
and ending with this:
')
The quotes can also be a double quotes. Both are supported, but not
escaped characters like ' or ".
When the code detects this syntax, it will strip the first 3 and last 2
characters, and this resulting string will become the actual jQuery:
$('resultingString')
This solves any possible ambiguity while trying to detect jQuery, and
works perfectly well in all scenarios.
I should push the official release tomorrow, if you can confirm that all
works well on your side.
About your other questions, I will get back to you later.
Cheers,
Norm
—
Reply to this email directly, view it on GitHub
<#90 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACQQXA7KMFMQOMHM5K3AB2DXWJPEZANCNFSM6AAAAAA3VLI5QE>
.
You are receiving this because you authored the thread.Message ID:
<cortexrd/Knack-Toolkit-Library/repo-discussions/90/comments/6774610@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Sorry Craig, I admit I wasn't clear enough. Since I know that you often use the Dev mode, when I said "If you have the chance to test the latest push on the dev branch" I meant for you to do a pull on that branch in GitHub Desktop and test it with your local server. Let me know if this works. |
Beta Was this translation helpful? Give feedback.
-
Hi Norm
That's what I did.
Craig
…On Mon, 21 Aug 2023, 12:34 Cortex R&D Inc., ***@***.***> wrote:
Sorry Craig, I admit I wasn't clear enough.
Since I know that you often use the *Dev mode*, when I said "*If you have
the chance to test the latest push on the dev branch*" I meant for you to
do a *pull* on that branch in *GitHub Desktop* and test it with your
local server.
Let me know if this works.
Norm
—
Reply to this email directly, view it on GitHub
<#90 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACQQXA7UNCUYGW7PWW3YFTLXWNBUDANCNFSM6AAAAAA3VLI5QE>
.
You are receiving this because you authored the thread.Message ID:
<cortexrd/Knack-Toolkit-Library/repo-discussions/90/comments/6779922@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
I think I've fixed it now. Do another pull and let me know it helps. |
Beta Was this translation helpful? Give feedback.
-
See your Teams messages. |
Beta Was this translation helpful? Give feedback.
-
Hi Norm So this is now fixed. If you need to hide a menu button you should put the cfv keywords on the details view where the condition is. Many thanks Norm for you time |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
Thought I'd share this custom Keyword I have created. This will hide elements if a value is matched or if you don't want it to match:
An example of calling this keyword:
_hebv=[field_2318, Post Treatment, .kn-details-link:contains("Treatment Extension"), .kn-details-link:contains("Mixed Sex House"), .kn-details-link:contains("Planned Length of Stay"), .kn-details-link:contains("Edit Detox")], [field_2318, !Post Treatment, .kn-details-link:contains("End Date")],
This keyword will also accept KTLRoles and multiple Instances.
Hope someone finds this useful
Craig
Beta Was this translation helpful? Give feedback.
All reactions