Probably a noob question

Hello guys,

I'm trying to develop my first plugin, and I'm struggling with knockout. The first version of my plugin has a sidebar update by knockout and everything is running fine, but now I want to add 2 more jinjas templates, one for sidebar and another for settings, both of then should be updated by knouckout (live content). But when I try to add any of the templates i can't bind them to knockout, and I receive this erro msg on my browser's console:

"Could not bind view model SafetyprinterViewModel to target #navbar_plugin_SafetyPrinter : parseBindingsString@http://localhost:5000/static/js/lib/knockout.js:74:172....."

What lines i need to change in my plugin files to add an extra template?
These were my steps:

  1. Created the template itself (SafetyPrinter_navbar.jinja2) and it is working (when i refresh Octoprint's UI it shows up);
  2. Added "dict(type="navbar", custom_bindings=True)," to get_template_configs on
  3. Added ""#navbar_plugin_SafetyPrinter" to "elements:" in "OCTOPRINT_VIEWMODELS.push" at SafetyPrinter.js

What's missing?

Thank you guys,


Care to link the source? Without it's just grasping at straws.

Here is a simple plugin that adds an icon to the navbar that might be a good reference.

It's here:

Thanks for the help. I checked your plugin and now its working. It seems that if you make any mistake on the jinja file, i.e. trying to bind one knockout variable to a property that in not applicable to the HTML object, you can have this erro.
But also i figured out that your plugin dont use "dict(type="navbar", custom_bindings=True)," and in my plugin it also returns the same error (when I uncomment that line).
Why this happens? I shouldn't declare it?

Ah cool.

This might help explain why Plugin Tutorial β€” OctoPrint 1.4.0.post29.dev0+g143cffd0 documentation (Not sure why it gets tagged as 1.4.x but should be pretty similar)

In my case I was likely using custom bindings originally and later switched it off and just left the definition. Would most likely work without even having it(dict(type="settings", custom_bindings=False) there.

Docs moved to from read the docs, now at Plugin Tutorial β€” OctoPrint master documentation

Side note @foosel, I've seen a few people confused with the old Read The Docs site, is it old enough to be disabled now?

Oh hah I didn't even notice the difference.

That is still online?! :face_with_raised_eyebrow:

edit Should be gone now. I've had it under for ages I didn't even realize that people were still using the rtd subdomain

1 Like

I wasn't on my normal machine and it came up as first result on DuckDuckGo. "octoprint docs custom_bindings"