Using JSON direct in widget

I am building a Mendix widget that wraps a jQuery widget that can process JSON formatted data directly. Now I use a mx.processor.get with a callback function that returns a list of mendix objects. I put that objects in a local array and feed it to the jQuery widget. Time and memory consuming. Using JSON could be more effective, but how? Is that done with a mxserver.request? Any sample of how to use it?
1 answers

If the jQuery widget has a method setData(data) or displayWidget(data, config, etc) then you could perhaps do:

   xpath : xpath,
   callback : dojo.hitch(this, function(mxObjects) {
     this.jQueryWidget.setData(, function(item) {
       return {
         widgetAttr1 : item.getAttribute('someAttr1'),
         widgetAttr2 : item.getAttribute('someAttr2'),
         mxObject : item /* store the mxObject for updates/commits perhaps */}

This is perhaps not a big improvement in terms of memory and time consumption, but a mapping of your domain model shouldn't be a time/memory concern (unless your displaying thousands of entity entries).

You should also have a look at the filter property passed to mx.processor.get(). This could reduce the size of the response data (and thus that which is stored in memory) as you can specify which attributes of the given entity you want to receive.

For more information on the filter property browse the forum, as I've asked a couple of questions on it.