Xpages: Can you build a Dojo Data Grid with a with a Rest service in a separate XPage? - xpages

I have created an Xpage with only one element, a JSON Rest service that points to a view (I guess I should probably put this in a CC).
I want to build another Xpage with a CC that contains a CC that contains a Dojo Data Grid that points to this rest service.
How can I do that? It seems to me that I should separate out my calls to the data from the interface. I am surprised that this is not easier to do.

As Knut mentioned, the xp:include tag (the Include Page control) seems to be the easiest solution.
You don't have to move the REST service to a custom control, though. You can just include the page with the REST service on the same page that contains your grid custom control (or on the grid custom control itself).
Then, in the grid's storeComponentId property of the grid control, you can specify the ID of the REST service and the server will be able to resolve it.

Put your REST service in a CC and include it into your Dojo Data Grid control XPages/CC.
<xp:include
id="restService"
pageName="restServiceCC.xsp" />
Don't forget to add ".xsp" to the name of your CC.
Update
To use include is the (only) way to separate the Dojo Data Grid control and the REST service in separate XPages/CC as you asked in your question.
As REST services can be separate design elements this way you can define all REST services in a template database and let the applications inherit from there. REST services itself can provide data from any database/view.
The Dojo Data Grid control is the easiest way to include Data Grids to your applications but it needs the REST service to be in the database itself.
As an alternative you can use a "pure" Data Grid based on client side JavaScript. Data Grids get their data usually from an URL per Ajax. This would give you the possibility to put all REST services in one database. You have much more flexibility with this approach than using the Dojo Data Grid control. But, be aware that it needs some days to get into it. I use the free jqGrid based on jQuery as the "pure" Data Grid. You can find more information about it in my presentation at EntwicklerCamp 2014 (sorry, its in German - Google translator is your friend) including a comparison with Dojo Data Grid and ExtJs Grid.

Related

Is there any possibility to create custom widget for Azure hosted API Management?

https://azure.microsoft.com/en-us/updates/new-azure-api-management-developer-portal-is-now-generally-available/
Extensibility—The portal comes built into every API Management instance (excluding the Consumption tier). If you wish to extend the portal’s core functionality (for example, create your own widgets to fetch data from other sources), fork the GitHub repository, implement the code changes, and self-host your own modified version of the portal.
Is it so that we can't do custom widgets on Azure hosted Developer portal? If so, then this is a backstep from the legacy portal as there we could write custom HTML and JS to get custom features.
I believe still there are couple of things you can do.
Home page
The default Home page is filled with dummy content. You can either remove the whole sections with the content or keep the structure and adjust the elements one by one. Replace the generated text and images with your own and make sure the links point to desired locations.
Layouts
Replace the automatically generated logo in the navigation bar with your own image.
Edit the content of the portal, customize the website's look, and publish the changes.
Please refer https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-developer-portal-customize and let me know how it goes
You can submit a pull request to the repository.
If you create a custom widget and this will be useful for many users it can be included in the default set of widgets.

Using custom control from another database

I need to use a custom control which is a simple navigation bar from another database
navigation bar is made with twitter bootstrap css framework,
why do I need to use a custom control from another database?
because this navigation bar is going to be common to four notes Databases,
how can I implement this more efficiently?, a control that is common to four databases
Domino includes template inheritance features that allow either an entire application or a specific design element (like a Custom Control) to be updated whenever the template design changes. You could link the shared Custom Control in each of your four applications to a common template so that, if you need to make changes to it, you only have to change it in one place. You can not reference a Custom Control that only exists in another application; you'd have to store it in each and link the design to keep it synchronized.
Alternatively, you can use the Extensibility API to convert it to a library component. Controls of this kind can be used in any application running on a server that has the library installed. A video tutorial for this process can be found here.

Customize OOTB Table of Content Web Part

I'm using OOTB Table Of Content web part. However, the structure that it displays slightly differs from the one I need to show. I need to hide several node + render some additional. I though that I could take advantage of the control that is used that Table Of Content web part (if there's one). Is it possible to achieve?
Thanks
I think you should use Content Query Web Part or you can create a new web part using OOTB toc web part as a base and render it on your own. You can do additional operations that way as well.

comparing sharepoint list and sqlserver table

I have a list in sharepoint which maintains particular month OnCall list,and we are maintaining employee directory in sql server. My requirement is to get complete data from sql server and show it in sharepoint and compare with sharepoint list and show small icon for the employees who are On Call for that particular Month. Can anyone please suggest me the waus of implementing this.
Thanks in advance.
Update: I have finished the part where I have to connect to the sqlserver database and get the employees information. For this we are using 3rd party web part to connect to the sql server and pull the data from the table. Now I have to show some kind of image on the employee name to show that he is on-call for that week. We are going to cretae custom list for maintaing the list of people who are on-Call. Can anyone please advise me on how to accomplish this.
Write a custom webpart which will pull the data from the list using sharepoint object model and SQL server using ADO.NET and do the said comparison.
If you were looking for out of the box, I am afraid there i too little information given here to analyze if its feasible out of the box or not.
If you have the SharePoint Enterprise version, you can look at using the Business Data Catalog. This will let you bind columns to external data sources. This might provide you with the functionality you're looking for.
If you do not have the Enterprise features, do you have access to deploy WSP packages and custom code?
You will have to write your own data access to your external data source. Your options would be to have a job that pulls data from the external data source and populates SharePoint list(s) or create a custom view that pulls the external data on-demand.
You'll have to come up with synchronization strategies. Meaning, is the data in the external SQL data source static, reference information that does not need to be updated depending on what a user does in SharePoint? This seems to be the case based on your question. If you do need to update the external data source, you'll have to hook into the on save event (so probably a custom event handler that listens for ItemAdding) to update the data, validate, and optionally cancel the operation with an error message.
If you can't deploy WSP packages / DLLs, you could take a look at the jQuery SharePoint library. This will let you interact with lists using jQuery. If you also write a WCF or Web Service wrapper around the data you need access to from your external data source that is accessible from the SharePoint environment, you can use hack together a solution.
To accomplish this you'd need to place a Content Editor Web Part on the page you need custom data access. In there you will write the code to reference the jQuery javascript library and jQuery SharePoint library. The code will have to make the calls to your external data service and make any updates you need.
This is the least reliable method to accomplish what you want since it's entirely page-based and can be broken by simply disabling script or someone editing the CEWP or removing it altogether.
If you don't have access to place a CEWP or any of the other solutions, then you have no options at all.
it relatively easy now to pull all the data using the third party webpart and saving it into a custom list. I would recommend you not only creating custom list but also creating the content types for this list. take a look at SharPoint MVP's post about creating a Custom List with Content Types

Sharepoint: Best way to display lists of non-Sharepoint content with "compatible" UI?

I've built a web part for Sharepoint that retrieves data from an external service. I'd like to display the items in a way that's UI-compatible with Sharepoint (fits in with its surroundings.)
I'm aware of the "DataFormWebPart" but was unable to get one working properly. It requires a valid DataSource and I was unable to build one from the results of a web service call... Part of the problem is that my web service wrappers don't expose the XML return info, rather I have a bunch of deserialized objects. There doesn't seem to be an easy way to turn actual objects into a datasource, or populate a "generic" datasource from object data.
I could use an SPGridView to get the same UI, but the grid control doesn't have much in the way of smarts -and- it forces every field into its own column. I'd prefer to render each list item as a single cell with complex rendering (for instance the way that StackOverflow shows its lists of questions.) I'd also like to get as much of the Sharepoint-standard UI as possible, such as the sorting, filtering, and paging controls.
So, first: Has anyone here written a Sharepoint control that does this, and if so do you have sample code to share? If not: am I overlooking some useful control, whether MS-supplied or available in an external library?
Thanks!
Steve
Sharepoint: Best way to display lists
of non-Sharepoint content with
“compatible” UI?
Take a look at the built in sharepoint web controls:
Microsoft.SharePoint.WebControls Namespace
It contains all the controls used in sharepoint. I'd tell you more, but the documentation is very thorough.
Problem with SharePoint is that there are a bunch of different ways to do this. If your data is not changing too often and is not overly large it may be worth considering entering it into a list for display.
If you have the Enterprise licence it may be worth getting your data into the BDC and using it there.
you may have to convert the objects into xml or use the serialised objects with the XML webpart for display. This still has the issue of custom rendering using XSLT.
Here's a great article that explains how to configure BDC connections to web services using the BDC Definition Editor:
Creating a Web Service Connection by Using the Business Data Catalog Definition Editor
http://msdn.microsoft.com/en-us/library/bb737887.aspx
The best way to do this IMO is to make a Web Part. As a Web Part the UI will be automatically rendered to be the same as the theme the site is using (unless you override it) and it will be able to be placed anywhere by anyone with admin privileges.
Tutorial on making a Web Part
Tutorial on packaging and deploying a Web Part
Example Web Part Source Code
You could create a custom web part and use an SPGridView. You say you don't like it, because it forces every field into its own column, but that's not true. You can create a template (ITemplate) for every column and fully customize what's shown inside it, just like you would using a normal ASP.Net GridView. Using this approach I've added the little "New" images right next to a list item's Title, just like SharePoint does itself.

Resources