Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Mark Drake 134 posts 458 karma points c-trib
    Sep 23, 2020 @ 20:41
    Mark Drake

    Refresh Content Tree from C#, Content Service Events

    Umbraco v8+

    Is it possible from server side code to refresh a portion of the content tree? My current theory is if I listened to the content service published event and determined that the content tree on the left should be refreshed - can I send this instruction to the client's browser?

    I'm working on this:

    I'd really like to trigger the content tree to refresh so the icon shows immediately upon publishing.

  • Mark Drake 134 posts 458 karma points c-trib
    Sep 25, 2020 @ 01:53
    Mark Drake

    I've taken a different approach since I started this topic. For anyone landing on this b/c they are trying to refresh the currently selected item in the tree, from C#, I have no idea.

    I've changed my approach and thus was able to do a lot of the things I wanted through the appState, treeService, and navigationService (client side). Even this was a conundrum. It's actually very easy to tell Umbraco to "refresh the currently selected node" but I honestly don't know what that does. It certainly didn't hit my custom tree rendering code, so it didn't get the updated icon.

    I finally used a combination of these services to reload the node children, and then used the sync tree method from the navigation because the active/highlight was lost in some instances.

    And I've done more backend programming than I'd ever like to. I've probably done a lot of things wrong, but I'm not going to prevent that from releasing this as an Umbraco Package soon. I'll learn live. Hopefully someone might be interested enough to contribute, help me clean it up, teach me a thing or two.

    A video of my progress.

  • Mark Drake 134 posts 458 karma points c-trib
    Sep 26, 2020 @ 06:17
    Mark Drake

    I've released my first nuget and umbraco package [scary].

Please Sign in or register to post replies

Write your reply to: