Skip to content

Commit

Permalink
Fixed #2192 - Add filter parameter to the lazyLoad method of VirtualS…
Browse files Browse the repository at this point in the history
…croller on Dropdown, MultiSelect and Listbox
  • Loading branch information
mertsincan committed Jul 14, 2021
1 parent 35b949b commit b8c8632
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/dropdown/DropdownPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class DropdownPanelComponent extends Component {
style: {...this.props.virtualScrollerOptions.style, ...{ height: this.props.scrollHeight }},
className: classNames('p-dropdown-items-wrapper', this.props.virtualScrollerOptions.className),
items: this.props.visibleOptions,
onLazyLoad: (event) => this.props.virtualScrollerOptions.onLazyLoad({...event, ...{ filter: this.props.filterValue }}),
itemTemplate: (item, options) => item && this.renderItem(item, options.index),
contentTemplate: (options) => {
const className = classNames('p-dropdown-items', options.className);
Expand Down
1 change: 1 addition & 0 deletions src/components/listbox/ListBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ export class ListBox extends Component {
if (this.props.virtualScrollerOptions) {
const virtualScrollerProps = { ...this.props.virtualScrollerOptions, ...{
items: visibleOptions,
onLazyLoad: (event) => this.props.virtualScrollerOptions.onLazyLoad({...event, ...{ filter: this.getFilterValue() }}),
itemTemplate: (item, options) => item && this.renderItem(item, options.index),
contentTemplate: (options) => {
const className = classNames('p-listbox-list', options.className);
Expand Down
1 change: 1 addition & 0 deletions src/components/multiselect/MultiSelectPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class MultiSelectPanelComponent extends Component {
style: {...this.props.virtualScrollerOptions.style, ...{ height: this.props.scrollHeight }},
className: classNames('p-multiselect-items-wrapper', this.props.virtualScrollerOptions.className),
items: this.props.visibleOptions,
onLazyLoad: (event) => this.props.virtualScrollerOptions.onLazyLoad({...event, ...{ filter: this.props.filterValue }}),
itemTemplate: (item, options) => item && this.renderItem(item, options.index),
contentTemplate: (options) => {
const className = classNames('p-multiselect-items p-component', options.className);
Expand Down
8 changes: 7 additions & 1 deletion src/components/virtualscroller/VirtualScroller.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ interface VirtualScrollerChangeParams {
numItems: VirtualScrollerStateType;
}

interface VirtualScrollerLazyParams {
first: VirtualScrollerStateType;
last: VirtualScrollerStateType;
[key: string]: any;
}

export interface VirtualScrollerProps {
id?: string;
style?: object;
Expand All @@ -90,7 +96,7 @@ export interface VirtualScrollerProps {
contentTemplate?: VirtualScrollerContentTemplateType;
onScroll?(e: React.UIEvent<HTMLElement>): void;
onScrollIndexChange?(e: VirtualScrollerChangeParams): void;
onLazyLoad?(e: VirtualScrollerChangeParams): void;
onLazyLoad?(e: VirtualScrollerLazyParams): void;
}

export declare class VirtualScroller extends React.Component<VirtualScrollerProps, any> {
Expand Down

0 comments on commit b8c8632

Please sign in to comment.