Hi, I am still learning metawidgets. I have a situation where I need to disable or enable 'href' and a 'button' based on data that is populated in a widget created using metawidgets. So, I already have an inspectionresultprocessor which reads a property file and renders the widgets native to Javascipt UI framework. I am unable to associate further rules that are dependent on the populated data. So, for example, if username is X, then enable edit else disable. Please help me with this.
Thanks in advance.
Blogged a complete example for you here: http://blog.kennardconsulting.com/2016/05/metawidget-associating-eventlisteners.html
Thanks for the example. It really helped. I have a related question. In the example, the property used is disabledUnless. Is 'disabledUnless' a special attribute/property like 'hidden' or is it something that was just defined in the js file for the example. Also, where can we find the complete list of property attributes (like 'hidden') in the documentation?
It was defined in the js file for the example. All the code you need is in the example. You can see it is injected by the Inspector, and handled by the WidgetProcessor (a few lines below).
I see. Thanks a lot for your prompt responses. It really helps a lot.
I have couple of more queries:
i) Is it possible to inspect two objects together and then buildwidgets.
For example, in showDialog method in contacts.js in Addressbook example, the object is given in the path as mw.setAttribute( 'path', 'addressbook.current' ); Here, how do we add another object such that the widgets from first one are readonly while second one are editable?
ii) How do we specify properties on nested attributes? For example, in the following JSON, if I have to hide ipAddress widget, how should I specify in JsonSchemaInspector?
I did try a few things but they did not seem to work...
Thanks a ton!
The idea here is you would use multiple Metawidgets on a page, either side-by-side or embedded within each other. Metawidgets are very lightweight (they can all share the same config objects). You can use lots together.
JsonSchemaInspector supports this automatically. It will be something like (note the items/properties convention, as defined by the JSON Schema specification):
Okay. I understand. Thanks a lot.
Can you please create a new forum post for each new topic? It helps people who are searching for similar questions.
Anyway, this should answer your question: http://blog.kennardconsulting.com/2016/05/metawidget-associating-eventlisteners.html (but instead of adding EventListeners, you would attach a validator).
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.