I'm trying to create a JIT pivotviewer and I have been kinda struggling a bit. Could someone clear my confusion on how the cxml is dynamically created? Also how should the information be set up for me to request it? I currently have it sitting inside of my database, do I need to create an xml doc for it to load from or can it pull it straight from the db?
Asked
Active
Viewed 1,299 times
1 Answers
0
For building a JIT PivotViewer collection you start by downloading the JIT example built by Microsoft.
Look around in the solution, when getting started the most important bit is the CollectionFactories
project. To create a collection using data from your database you need to create your custom CollectionFactory
.
Your custom collectionfactory extends the CollectionFactoryBase
class:
class MyCustomCollection : CollectionFactoryBase
the class needs to implement the MakeCollection
method, all this method has to do is create an instance of Collection
class and add CollectionItems
to it.
public override PivotServerTools.Collection MakeCollection(CollectionRequestContext context) {
return MakeCollection();
}
private static PivotServerTools.Collection MakeCollection() {
PivotServerTools.Collection collection = new PivotServerTools.Collection();
collection.Name = "MyImages";
ItemImage[] fileList = ImageListFromDatabase();
foreach (ItemImage image in fileList) {
collection.AddItem(image.Name, image.ImageUrl.ToString(), image.Description, image, null);
}
return collection;
}
Now to use this collection and see it in action, you need to provide the name of the collection
for the PivotViewer Silverlight application (PivotServer
) in the solution:
default.aspx
<param name="initParams" value="cxml=MyImages.cxml" />

texmex5
- 4,354
- 1
- 26
- 28
-
Definitely helped, thanks. But now I'm running into a problem where my JIT doesn't load the images as images, they show up as a facet to query against and just displays the standard green box. I've checked through the project but I couldn't really find how the cxml files are created in order to display the images. – Rob Jun 24 '11 at 00:19
-
I don't follow you, maybe you could post a screenshot? You see pivot collection, where instead of images you have boxes for each image? – texmex5 Jun 24 '11 at 08:38
-
Its showing what I assume is the default background when you don't supply an image. [link]https://skydrive.live.com/?wa=wsignin1.0&cid=637c712fa84d9985&sc=photos#!/?cid=637C712FA84D9985&id=637C712FA84D9985!106&sc=photos!cid=637C712FA84D9985&id=637C712FA84D9985!107&sc=photos and https://skydrive.live.com/?wa=wsignin1.0&cid=637c712fa84d9985&sc=photos#!/?cid=637C712FA84D9985&id=637C712FA84D9985!106&sc=photos are two images of what I'm describing – Rob Jun 24 '11 at 17:38
-
Check and recheck your image paths. – texmex5 Jun 24 '11 at 18:55
-
How should I configure the image paths? Currently I have them set inside the server, the link isn't set as a URL but I'm not entirely sure that is how it's supposed to be set up. – Rob Jun 28 '11 at 20:42