Async Widget Data Retrieval

Topics: Core, Writing modules
Jul 8, 2012 at 3:01 PM

Hi Guys,

My Question:

I am thinking about passing the widget ID, but how do I retrieve the widget data by it ID?

My Context:

I am just starting with Orchard creating my own website.

And I am creating a widget that accesses LinkedIn and retrieves my profile.

Until here everything is simple, the problem is that I want the page to return immediately to the client.

So I configured the widget the send to the page a KnockoutJS template and a Script that retrieves the data async and applies the template on the client.

For this I created a Controller that retrieves the data using JSON. But here is the problem, all the configuration data and context is configured in the widget, and when I access the endpoint to retrieve my profile data, I don't know what to return.

I am thinking about passing the widget ID, but how do I retrieve the widget data by it ID?

PS: Anyone interested in the same functionality can ask me for the module. :)

Jul 10, 2012 at 7:59 AM
Hi, have you had a look at the WidgetService class, does it not offer what you need? What exactly do you mean by Widget data?

Maybe this will help - copied from WidgetServive with an addition to filter on the Id:
Inline-Bild 1
You just need a ContentManager where you want to do this but Autofac should do that for you, basically.

Cheers, Oliver
--


2012/7/8 tlootno <notifications@codeplex.com>

From: tlootno

Hi Guys,

My Question:

I am thinking about passing the widget ID, but how do I retrieve the widget data by it ID?

My Context:

I am just starting with Orchard creating my own website.

And I am creating a widget that accesses LinkedIn and retrieves my profile.

Until here everything is simple, the problem is that I want the page to return immediately to the client.

So I configured the widget the send to the page a KnockoutJS template and a Script that retrieves the data async and applies the template on the client.

For this I created a Controller that retrieves the data using JSON. But here is the problem, all the configuration data and context is configured in the widget, and when I access the endpoint to retrieve my profile data, I don't know what to return.

I am thinking about passing the widget ID, but how do I retrieve the widget data by it ID?

PS: Anyone interested in the same functionality can ask me for the module. :)

Read the full discussion online.

To add a post to this discussion, reply to this email (orchard@discussions.codeplex.com)

To start a new discussion for this project, email orchard@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Jul 11, 2012 at 10:49 AM

A widget is just a content item, so if you have the id, you can get the content item from ContentManager.