In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Blog link: https://blog.51cto.com/13969817
Webpart is basically indispensable in every Portal project, but the development of webpart in SharePoint Online is not very casual. We can no longer develop visual webpart at will like in On-Permise environment. We need to carry out specific analysis according to specific functions.
For example, Visual Studio creates an application with a hello-worldish script in App.js. The script retrieves the display name of the current user and places it in the default App page default .aspx. Sample Code:
'use strict'
Var context = SP.ClientContext.get_current ()
Var user = context.get_web () .get_currentUser ()
/ / This code runs when the DOM is ready and creates a context object which is needed to use the SharePoint object model
$(document) .ready (function () {
GetUserName ()
});
/ / This function prepares, loads, and then executes a SharePoint query to get the current users information
Function getUserName () {
Context.load (user)
Context.executeQueryAsync (onGetUserNameSuccess, onGetUserNameFail)
}
/ / This function is executed if the above call is successful
/ / It replaces the contents of the 'message' element with the user name
Function onGetUserNameSuccess ()
('# message') .text ('Hello' + user.get_title ())
}
/ / This function is executed if the above call fails
Function onGetUserNameFail (sender, args) {
Alert ('Failed to get user name. Error:' + args.get_message ())
In order to improve efficiency, first of all, we need to analyze whether the information display of a certain area can be realized through the Webpart of SharePoint's OOB, instead of requiring each Webpart to be developed on its own. If it is true that OOB's Webpart cannot be implemented, we are considering using App Part to implement it.
Try to use CDN to introduce the js and css needed in app part, because if an app package contains multiple app part and add these app part on the same page, it will cause too many requests and some css and js in the app site cannot be loaded. Using CDN can reduce some requests and avoid some of these problems.
In order to avoid multiple App Part using a single App Site, if you put many such app part on the same page, it will lead to too many requested resources for this app site and bring unexpected problems. It is best to develop a separate app for each app part.
Try to reduce the number of requests. For unnecessary requests, we can replace them with the attributes of App part. For example, a fully functional app part may need to click item to jump to the view item page, then the URL can be configured through attributes instead of a separate request through REST API.
For example, SharePoint Host's App Part uses SharePoint REST API or JSOM to get the data, and draw the effect we want, but in this way we rely too much on the SharePoint site, that is, we need to use css and js exist in the SharePoint site, if we port this Webpart to another site, this site must also deploy the corresponding js and css files, the dependency is strong. Here we need to use SharePoint Host App's app part instead, because app part is actually an Iframe, and the js and css used in the App part we developed are independent of app site, so it's easy to port.
I hope the summary of this article will be helpful to your development in the future.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.