Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Control - ViewPicker - Fixing Issue 1439 #1526

Merged
merged 105 commits into from
Sep 10, 2023
Merged

New Control - ViewPicker - Fixing Issue 1439 #1526

merged 105 commits into from
Sep 10, 2023

Conversation

NishkalankBezawada
Copy link
Contributor

@NishkalankBezawada NishkalankBezawada commented Apr 28, 2023

Q A
Bug fix? [ ]
New feature? [x]
New sample? [ ]
Related issues? fixes #1439

What's in this Pull Request?

Added a new control 'ViewPicker' which enables to select the list views just like ListPicker, SitePicker, FieldPicker controls

Properties used

Property Type Required Description
context BaseComponentContext yes The context object of the SPFx loaded webpart or customizer.
className string no If provided, additional class name to provide on the dropdown element.
disabled boolean no Whether or not the view picker control is disabled.
filter string no Filter views from Odata query.
label string no Label to use for the control.
listId string no The List Id of the list.
placeholder string no Placeholder label to show in the dropdown.
orderBy Enum no How to order the set of views (By ID or Title).
selectedView string OR string[] no Keys(View Ids) of the selected item(s). If you provide this, you must maintain selection state by observing onSelectionChanged events and passing a new value in when changed.
multiSelect boolean no Optional mode indicates if multi-choice selections is allowed. Default to false.
showBlankOption boolean no Whether or not to show a blank option. Default to false.
viewsToExclude string[] no Defines view titles which should be excluded from the view picker control.
webAbsoulteUrl string no Absolute Web Url of target site (user requires permissions)
onSelectionChanged (newValue: string OR string[]): void no Callback function when the selected option changes.

Screens

Below is the implementation of the control

    <ViewPicker context={this.props.context}
        listId={"9f3908cd-1e88-4ab3-ac42-08efbbd64ec9"}
        placeholder={'Select list view(s)'}
        orderBy={orderBy.Title}
        multiSelect={true}
        onSelectionChanged={this.onViewPickerChange} />

image

  • The onSelectionChanged change event returns the selected view(s) and can be implemented as follows in your webpart:
  private onViewPickerChange = (views: string | string[]) => {
    console.log("Views:", views);
  }

Below is the screen of the control from workbench

image

Below is the screen of the control in single selection mode

image

Below is the screen of the control in multi selection mode

image

Below are the sample screen of the list views.

image

//Nishkalank Bezawada

@NishkalankBezawada NishkalankBezawada marked this pull request as ready for review April 28, 2023 16:59
package-lock.json Outdated Show resolved Hide resolved
NishkalankBezawada and others added 21 commits June 28, 2023 15:55
Fixing Issue 1580 - Broken behavior: files containing dots in the name
Fix- Issue 1421- PeoplePicker Control - Shows wrong value in Dynamic Form when null is provided & Issue 1578 - DynamicForm - Error on save when clearing person from Person or Group field and leaving it blank.
Fix ModernTaxonomyPicker used language by checking for supported term…
@joelfmrodrigues
Copy link
Collaborator

@NishkalankBezawada we merged a PR that makes the test control much simpler, but this means that your PR now has conflicts.
Could you please sync your branch and resolve the ControlsTest conflicts? In summary, the visibility of each control is now controlled by a switch that is associated with a state property, and the controls are only displayed if the user toggles the switch. Should be easy to update by just copying the test control you added and adding it again to the latest version of the ControlsTest.tsx file

Let me know if you run into issues

@NishkalankBezawada
Copy link
Contributor Author

Hello @joaojmendes

I have now merged the conflicts on my repo.

Thanks,
Nishkalank

@NishkalankBezawada
Copy link
Contributor Author

Hello @joelfmrodrigues,

As per your suggestion, i have modified the component, and added my control to it. It works with my branch now.

image

Thanks,
Nishkalank

@joelfmrodrigues joelfmrodrigues merged commit 1dd585e into pnp:dev Sep 10, 2023
1 check passed
@joelfmrodrigues
Copy link
Collaborator

@NishkalankBezawada Sorry for the very long delay that the entire process took and for all the updates you did along it. This is now merged 🙂

@joelfmrodrigues joelfmrodrigues added this to the 3.16.0 milestone Sep 10, 2023
@NishkalankBezawada
Copy link
Contributor Author

@NishkalankBezawada Sorry for the very long delay that the entire process took and for all the updates you did along it. This is now merged 🙂

Thanks @joelfmrodrigues This was long awaited one ☺️.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet