Options

Page Action - Toggle Button Visibility

doddwelldoddwell Member Posts: 65
Hello
I have two 'filter' buttons on a List Page "All Orders" & "My Orders" and I want only one button to display at a time.

The Page initially Opens showing all Orders and, therefore the "My Orders" Action button is visible.

The "All Orders" button Visible property has a variable - AllOrdersVisible
The "My Orders" button Visible property has a variable - MyOrdersVisible

We have a ToggleVisibleButtons function:

LOCAL ToggleVisibleButtons()
AllOrdersVisible := MyOrdersVisible;
MyOrdersVisible := NOT AllOrdersVisible;

ToggleVisibleButtons() is called when the Page Opens and each time one of the Filter Action buttons is pressed.

Now for the problem:

When the "All Orders" filter button is pressed, the behaviour is as you would expect - the list page displays all records and the "My Orders" filter button is shown and the "All Orders" filter button is hidden.
BUT.....When the "My Orders" filter button is pressed, the list page displays My records BUT the "My Orders" filter button is still shown and the "All Orders" filter button remains hidden. If I click the "My Orders" button again, you then get the behaviour you would expect.

Any ideas why I have to press the "My Orders" button twice?

Many Thanks


Best Answer

Answers

  • Options
    KishormKishorm Member Posts: 921
    Have you set the IncludeInDataset property on both of the Boolean variables to Yes?
  • Options
    doddwelldoddwell Member Posts: 65
    Hello Kishorm. No....I hadn't. Just tried it though and has no effect. Thanks.
  • Options
    endjinnendjinn Member Posts: 11
    Sounds like a CurrPage.UPDATE issue. Add CurrPage.UPDATE to refresh the page.
  • Options
    KishormKishorm Member Posts: 921
    Are you calling the ToggleVisibleButtons() anywhere else? Maybe it's getting called again when setting the filter to "My Orders" and is therefore going back to its original value?
  • Options
    doddwelldoddwell Member Posts: 65
    Endjinn...tried that...no good.
    Kishorm....have checked and it's not being called twice.
    Thanks
  • Options
    KishormKishorm Member Posts: 921
    I'd put a message in the ToggleVisibleButtons() function showing the value of the 2 variables, hopefully this should give you a clue as to when/why it's not working as expected.
  • Options
    doddwelldoddwell Member Posts: 65
    As suggested, I added a message to return the value of the 2 variables...these were as expected. I have noticed something significant about the behaviour though. I don't actually have any Orders assigned to me - so "My Orders" filter action return no records. When another user (with Orders assigned) runs the Page, the behaviour is as you would expect.

    So it's something to do with the fact that I do not have any records...but the ToggleVisibleButtons() is called still called after my empty data set is displayed (I have also tried calling the ToggleVisibleButtons() function before the filter is applied...same result).

    Thanks
  • Options
    ricardopaivaricardopaiva Member Posts: 14
    edited 2016-11-18
    Doodwell,

    What NAV version are you using?
    Can you reproduce this behavior in a Cronus database? If so, export the modified page as text file (from the Cronus database) and share it.
    It is easier for us to try and find out what's going on.

    Regards
Sign In or Register to comment.