Hi, We need to create a widget and offcourse we are looking into the React/Pluggable widget stuff. Looks nice. The widgets needs a context and the datasource will use this context object to retrieve related data. That part works just fine. But i ran into some problems: Do I have access to the context object in the widget? I see that there is “this.context”, but seems to be empty. The context contains some (dynamic) configuration data. If we can access the context object, how do we get data from it (can we configure attributenames)? Can I get new data and add it to the dom? The data source gets the first 10 results. When clicking a button, I want to get the next 10 results and add it to the dom. I see that all data has to be retrieved again and that the rendering is done again. As far as I understand, React is smart in rerendering the DOM and only updates the changed data (is this correct?), but I can see some performance issues when there is a lot of data to be retrieved. That’s why I want to get only the next 10 results, not all the already available data. What is the best way to get this done and keep the dataload as small as possible? I've looked at the new DataGrid, but that will get all data (offset=0) each time the data gets loaded (with infinite scrolling). How long will the “old” custom widgets be supported? I do want to create the widget in the new way, but maybe I have some challenges so I have to create an “old” custom widget now, and rewrite it when the required functionality will become available in the pluggable widgets?
Here's my 2 cents:
to read the actual value
Yes you can. Typically the DOM element isnt rerendered if all props are the same. It could be that if context changes props will quickly changes, hence rerender all DOM elements. If this is the case for you, use the React function shouldComponentUpdate to check, based on new and old props/state whether to rerender the dom or not
This is not known. My advise would be, move to React. The only really annoying thing I found is that in the pluggable widgets API it is currently not possible to change a value coming from a type=datasource, see: https://forum.mendix.com/link/questions/105072. Next to that there are only benefits I would say.