mirror of
https://github.com/pnp/sp-dev-fx-webparts.git
synced 2025-02-07 21:48:24 +00:00
Small adjustments on the code and improvements on the readme.
This commit is contained in:
parent
e36c8c344b
commit
eae60906b9
@ -18,4 +18,6 @@
|
||||
"lib": true,
|
||||
"temp": true
|
||||
}
|
||||
,
|
||||
"typescript.check.workspaceVersion": false
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
# Display List JavaScript Client-Side Web Part
|
||||
|
||||
## Summary
|
||||
Sample Web Part that demonstrates the use of JavaScript in creating a SharePoint Framework web part. The properties pane for this web part display a drop down list of lists in the current web. Once the user selects one of the lists, the web part display the contents of the list.
|
||||
Simplistic sample Web Part that demonstrates the use of JavaScript in creating a SharePoint Framework web part. The properties pane for this web part display a drop down list of lists in the current web. Once the user selects one of the lists, the web part display the contents of the list.
|
||||
|
||||
|
||||
![Screeshot of the Display List web part](./assets/display-list-preview.png).
|
||||
|
||||
> Does only show data when hosted in SharePoint. No mock data at this point for local testing the rendering.
|
||||
|
||||
## Applies to
|
||||
|
||||
* [SharePoint Framework Developer Preview](http://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview)
|
||||
@ -39,6 +41,7 @@ Version|Date|Comments
|
||||
- `tsd install`
|
||||
- `gulp serve`
|
||||
- `Open the *workbench* on your Office 365 Developer tenant`
|
||||
- Basic functionality can be tested locally, data is only shown when used in context of SharePoint
|
||||
|
||||
## Features
|
||||
The js-display-list web part displays the content of the list specified in the web part properties pane.
|
||||
|
@ -38,7 +38,7 @@ export default class JsDisplayListWebPart extends BaseClientSideWebPart<IJsDispl
|
||||
}
|
||||
|
||||
public render(): void {
|
||||
debugger;
|
||||
// debugger;
|
||||
this.context.statusRenderer.clearError(this.domElement);
|
||||
this.context.statusRenderer.displayLoadingIndicator(this.domElement, strings.Loading);
|
||||
Log.verbose('js-display-List', 'Invoking render');
|
||||
@ -109,24 +109,18 @@ public onInit<T>(): Promise<T> {
|
||||
|
||||
private _renderList(items: ISPList[]): void {
|
||||
let html: string = '';
|
||||
debugger;
|
||||
|
||||
|
||||
//debugger;
|
||||
items.forEach((item: ISPList) => {
|
||||
let title: string = '';
|
||||
|
||||
if (item.Title === null)
|
||||
{
|
||||
if (item.Title === null) {
|
||||
title = "Missing title for item with ID= " + item.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
title = item.Title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var created = item["Created"];
|
||||
|
||||
html += `
|
||||
@ -137,8 +131,7 @@ public onInit<T>(): Promise<T> {
|
||||
</div>`;
|
||||
});
|
||||
|
||||
if (items.length == 0)
|
||||
{
|
||||
if (items.length == 0) {
|
||||
html = '<br /><p class="ms-font-m-plus">The selected list is empty</p>';
|
||||
|
||||
}
|
||||
@ -168,7 +161,7 @@ public onInit<T>(): Promise<T> {
|
||||
const listContainer: Element = this.domElement.querySelector('#spListContainer');
|
||||
|
||||
// Local environment
|
||||
debugger;
|
||||
// debugger;
|
||||
if (this.context.environment.type === EnvironmentType.Local) {
|
||||
let html: string = '<p> Local test environment [No connection to SharePoint]</p>';
|
||||
this.context.statusRenderer.clearLoadingIndicator(this.domElement);
|
||||
|
Loading…
x
Reference in New Issue
Block a user