Hide Menu buttons

Hi,

anyone have an idea for hiding menu buttons based on field values or other parameters? I dont think it can be done natively

thanks,
Andrew Steele (UK)

yes, you can.Use page Rule to hide menu based on record value.

Yea I’m aware and use that. I meant individual buttons on a menu. Hide one or more of the buttons based on values.

you can hide the view of that button, and create a text rich message view for user highlighting, why can not access this view.use page rule to hide and show based on record value.

Not sure I understand that reply, sorry.

Hi Andrew

You might be able to achieve this using KTL

Try posting your question in their forum cortexrd/Knack-Toolkit-Library Ā· Discussions Ā· GitHub

Dean

1 Like

Hi Andrew

Sorry, here’s what I was thinking of that might be of help.

_cfv=[Has Archived Notes, is, Yes, black, #ffbb73, bold,], [ktlTarget, $(ā€˜#view_347 .knMenuLink:textEquals(ā€œArchived Notesā€)’)]

image

Dean

Hi Dean,

thanks for this - I will have a play - thank you.

I guess I could have different menus in different views and hide the ones that don’t apply - a bit long winded but should work.

1 Like

That’s what i do. All works within native Knack.

See the feature requests

Yes you can use different menus but that can be tricky if you can’t get both menus linking to the same pages

We use js or KTL.

$(document).on('knack-view-render.view_123', function(event, {key: viewId} ) {
  $(`#${viewId} li:contains('some text')`).remove();
});

Replace 123 with your menu view Id and some text with your menu button text.

If you want a specific condition for the code let me know and I can update the code.

Craig

Hi Craig,

thanks for this … I agree with the ā€œextraā€ menu point to you make as you have to create new views with the same data sometimes, several times.

I will try your method on a test app.

1 Like

I’d use the KTL’s keyword _cls (Add/Remove Class) to hide the button conditionally, like this:

In my example, I have two conditions that hide each menu button, based on the value of the fields in the form below. This works with details views also.

Enjoy!!
Norm

2 Likes

Hello Craig,

Thank you very much for your tip.

We will probably test it as js as we don’t use KTL.

Michael