TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raghavendar Swaminathan
431
3.6k
140.5k
SPFx Webpart getting loaded with delay
Mar 3 2020 12:17 PM
Hi Team,
I am facing some challenges in the loading time of the webpart(15 secs). I was pulling data from the list and binding it to the drop down control in ajax but it has some waiting time since async call is involved.
I need a better performance how this can be achieved. can anyone provide insights.
function
getPackingSites()
{
var
packagingSiteUrl = siteAbsUrl +
"/_api/web/lists/GetByTitle('"
+packingSiteList+
"')/Items"
;
var
packagingSiteOptions =
""
;
$.ajax({
url:packagingSiteUrl,
method:
"Get"
,
async:
false
,
headers: {
"accept"
:
"application/json;odata=verbose"
,
},
success:
function
(PackingSiteData) {
if
(PackingSiteData.d.results.length > 0) {
for
(
var
i = 0; i < PackingSiteData.d.results.length; i++) {
packagingSiteOptions +=
"<option value='"
+PackingSiteData.d.results[i].ID+
"'>"
+PackingSiteData.d.results[i].Title+
"</option>"
;
}
}
},
error:
function
(x, e) {
alert(e.message.tostring());
}
});
$(
"#PackingSiteDropdwn"
).html(packagingSiteOptions);
var
tempLink =
'<a id="newformSubmit" class="btn offset" href="'
+siteAbsUrl+
'/pages/Create.aspx?PackSiteID='
+$("#PackingSiteDropdwn
").val()+'&Source='+siteAbsUrl+'"
>Submit</a>';
$(
"#newformSubmitSpan"
).html(tempLink);
}
}
Reply
Answers (
1
)
Empty value in choice column
Html Text Box Validation in Sharepoint online using RESTAPI