Skip to content

Business-Objects

Async

private async loadScripts(): Promise<void> {
    return new Promise<void>(async (resolve) => {
        if(this._context) {
            resolve();
        }

        const response =  this.loadScript(layoutsUrl + 'init.js', 'Sod');
        resolve();
    });
  }

Load Data from SP-List Code

private async _loadList(): Promise<void> {
    this.setState({
        loading: true
    });
    let items = await pnp.sp.web.lists.getByTitle("Events").items.select("Id", "Title", "SPFxDescription", "SPFxThumbnail")
        .orderBy("Modified", false).get();
    _items = items.map((item: IList, index: number) => {
        return {
        thumbnail: item.SPFxThumbnail != null ? item.SPFxThumbnail.Url : "",
        key: item.Id,
        name: item.Title,
        description: item.SPFxDescription
        }
    });
    this.setState({
        sortedItems: _items,
        columns: _buildColumns(),
        loading: false,
        newsFeedVisible: false
    });
    _lastQueryDate = moment();
}