Question

Does anyone have any experience using a MVVM pattern and /or knockout.js, angular,js, or handlebars/js with sitecore's page editor mode?

I haven't done alot of page editor mode work, but my gut feeling is that the sitecore context required for the field renderers is going to be a problem if using any of the above libraries.

Before getting too deep into a prototype, can someone tell me if this is even possible?

It would be a bonus if there is some documentation or an example out there.

Was it helpful?

Solution

There is a lot of functionality going on behind all the different types of controls and making them work in Page Editor you will be sinking far too much time into this imo. Even some of the ORM projects like Glass.Mapper fall back to using Sitecore controls for Page Editor mode.

I'd think very carefully before going down this path. Not just from a technological point of view, but also from a support, maintenance and future upgrade point of view.

I noticed you tagged the question with Sitecore 6, but the latest version of Sitecore is 7 with 7.1 due this month with SPEAK UI support. You don't know what changes will be coming up in the future versions, at least with a more standard approach you know Sitecore has an upgrade path for your project which will be less painful.

And what happens if you leave and someone else needs to take over the project? Sitecore is a pretty niche developer market, you've just made your candidate base even more niche. You also have to think from a Sitecore Support perspective, if you ever need to engage them then you might run into another issue.

Then you also need to take into account DMS, personalization, A/B and multivariant testing, all from within the Page Editor all of which just opens up a whole other can of worms.

There's no reason you can't use Knockout.js alongside Sitecore for some parts of your project though.

That's just my 2 cents though.

BUT don't let that stop you exploring the idea though, it's what drives progress and has led to some awesome shared source modules :)

OTHER TIPS

My assumption would be that if you're using Angular or some sort of MVVM library to build an app, and you want it populated with data from Sitecore, you'd need to build a RESTful service to pull data from the Sitecore API.

I can't imagine an instance in which this would play well with Page Editor. Your templates in Angular would never be running through .net. Even if you tried to get tricky and use templates in angular that were .aspx or .ashx or something that did get run through IIS, Angular would likely be caching those locally so they wouldn't be able to be resused at all.

There are a few things out on the web about Sitecore + Angular together, but nothing I can find that at all mentions Page Editor support.

http://www.isitedesign.com/sitecore/2013/11/14/building-single-page-applications-with-angular-and-sitecore/ https://github.com/PetersonDave/SinglePageAppDemo

To get data from Sitecore via REST, you could utilize the Sitecore Item Web API, that allows for HTTP based access to the items in Sitecore.

Look at the Sitecore Developer Network for more info. Also there are several nice articles floating around on the topic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top