Restoring App State with the Bookmark Widget

251
2
09-16-2024 11:25 AM
JeffreyThompson2
MVP Regular Contributor
0 2 251

Do you feel that wintery chill in the air? I don't. I live in Texas. But here we are, only two weeks away from Venezuelan Christmas. What's on your wish list this year? For a lot of you, it's this...

JeffreyThompson2_0-1726506593676.png

That little box from WebAppBuilder that will restore your last session. Come on ESRI, please. We've been very good this year. At least, say you're working on it. But what if we don't need it, what if the true restore app state widget was inside us all along...

It's not. But, you can hack the Bookmark Widget to get something close.

Did you know that bookmarks save the current layer visibility as well as the map extent? They do. And that's really all this trick is. Honestly, I'm not sure this is even a trick. It feels awful close to an intended use case, but not a super obvious one. Or maybe ya'll know this already and I'll look like an idiot for thinking this is remotely clever. I build stuff. I don't use stuff. Builders and users don't always see stuff the same way. We need to see this from both perspectives for this trick to work.

Builder Me

As Builder Me, I will add a Bookmark Widget to my project. I will use that second template on the top row as it will give the best appearance for this usage. I'll turn on Allow To Add Bookmarks In Widget and make sure Ignore Layer Visibility is off.

JeffreyThompson2_0-1726510477590.png

That's it for set-up. I won't add any of my own bookmarks for this usage.

User Me

I go about doing my job until the clock reads quittin' time. I open up the Bookmark Widget and hit the plus sign. I could rename it if I want. Maybe today's date. Don't have to. Tomorrow, I come into work, hit my bookmark and get back to my job. The end. App state restored.

Merry Christmas and a Happy Six-Weeks 'til Halloween.

2 Comments
About the Author
A frequently confused rock-hound that writes ugly, but usually functional code.