No way to unset a single local stickyGet

The subject pretty much says it all. I’ve been using a local stickyGet to pass along a number of user-chosen parameters that control how a data table is viewed, and everything works great – untill the user decides that they want to remove a filter they’ve set. In my case, this is the default state and would be equivalent to forgetting the local StickyGet value.

The documentation even says “Sometimes you want to drop a sticky argument. If your sticky was set locally, you can drop it by calling either a parent’s url or $app->url()”. That’s all well and good if you want to drop all of your locally-set StickyGet values – but what if you only want to drop one of them, and keep the others?

As a work-around, I’ve added a flag value to use to mean that the sticky has been unset. This works, but it seems awkward – and sometimes null/unset is really what you want and there is no non-null value that one could use as a flag.

The code for \atk4\ui\View’s stickyGet method simply tests for whether or not the supplied value is true, and then it uses the supplied value to replace it. So there’s no way to drop an individual local sticky value by setting it to null, false, empty, etc. It would be very useful if this check were changed to !== null, or something similar, so that we could pass a false value and have stickyGet then drop that value. Alternatively, and probably cleaner, would be to have a stickyForget method on the View that would do the same thing as App’s stickyForget method.

You can do $view->owner->url() if you don’t want sticky argument’s of a specific view to be in the URL. StickyForget is a work-around for lack of contextual sticky arguments. You may be doing something incorrectly.

I see that – but wouldn’t that wipe out all contextual sticky arguments? What if I only want to forget one of three?