Call your webservice from a widgets datasource - Mendix Forum

Call your webservice from a widgets datasource


Use your REST services as datasource! 

Many of the display widgets, like charts and aggregated data, don't need the full Mendix object to work but they do use lots of data. I'm rewriting my old widgets to new pluggable React widgets and the new datasource options are great. However, pulling thousands of Mendix objects to the client just to use them in a widget is very slow. When you create a web service and use that as datasource, plain JSON is transferred, which does not clutter the client state and is much more lightweight. 

2 answers

Hi Anthony, I took charts as example to implement it in my new widget. While creating my widget I thought this should be easier for the Mendix developer that uses the widget.


Great idea Marcel. For the charts this is already possible. I have done some testing and it seemed that the option where you use the AnyChart and just plain JSON is transferred.


We have also changed one widget – which uses an external library –  in a way that the configuration is not added in Mendix Studio via all kinds of properties in the widget itself, but via two or three properties that accept JSON. That way, when a new library / function is added to the external dependency, you can just specify it in the JSON. Add a codepen in the docs and you can play around with it. Don’t know if it will work for all widgets, but works like a charm in our case.