Skip to content

DS_SharePointDataCard PCF control works with additional changes #94

Description

@hamhus

I managed to resolve the issue 1 and 2, see issue #93

The resolution is you need to add dataset options to the sampleDataSet in the ControlManifest.input.xml.
<data-set name="sampleDataSet" display-name-key="Dataset_Display_Key" cds-data-set-options="displayCommandBar:true;displayViewSelector:true;displayQuickFindSearch:true">

For #1, I needed to add a temporary global variable, because when you select a document in the view, the call is going to the notifySelectedRecords function, but eventually it goes to the UpdateView, and from there it goes into the recordsDecorator. The recordsDecorator function makes the selected=false, which is why the checkbox were not getting selected. I added a variable this._setSelected=0; I am changing this value in the notifySelectedRecords, and in the UpdateView checking if (this._setSelected!=1){//recordsDecorator} and at the end of it, I am re-setting the value to this._setSelected=0. Here's how the code looks like.

private notififySelectedRecords(recordId:string)
	{
		let currentRecord = this._allRecord.find(p => p.id == recordId)!;
		currentRecord.selected = !currentRecord.selected;
		this._setSelected = 1;
		this._context.parameters.sampleDataSet.setSelectedRecordIds(this._allRecord.filter(p => p.selected).map( p=> { return p.id}));
	}
public updateView(context: ComponentFramework.Context<IInputs>): void
	{
		this._context = context;
		let dataset = context.parameters.sampleDataSet;
		if(this._setSelected != 1)
		{
			this.recordsDecorator(dataset);
			dataset.setSelectedRecordIds([]);
			ReactDOM.render(
				React.createElement(
					App,
					{
						elements: this._allRecord,
						enableLoadMore : this._context.parameters.sampleDataSet.paging.hasNextPage,
						loadNextRecords: this.loadNextRecords.bind(this),
						setSelectedRecord: this.notififySelectedRecords.bind(this)
					}
				),
				this._container
			);
		}
		this._setSelected = 0;
	}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions