1.3.0 • Published 5 years ago

nativescript-filter-select v1.3.0

Weekly downloads
16
License
MIT
Repository
github
Last release
5 years ago

FilterSelect

npm npm

A NativeScript plugin to provide an listview widget to select AND filter items.

Sample Screenshots

Android and ios

Sample 1Sample 2
Sample1Sample2

Installation

NativeScript 4.x
  • tns plugin add nativescript-filter-select

import css

@import 'nativescript-filter-select/styles.css';

*Be sure to run a new build after adding plugins to avoid any issues

Vanilla NativeScript

IMPORTANT: Make sure you include xmlns:FS="nativescript-filter-select" on the Page element

XML

<Page xmlns:FS="nativescript-filter-select">
   <StackLayout>     
     <FS:FilterSelect 
     items="{{ countries }}"
     hint="Please select some countries" 
     modal_title="Countries" search_param="name" 
     primary_key="code" 
     change="{{ onSelect }}"
     />
   </StackLayout>
</Page>

Angular NativeScript

Regiter plugin in Component class

import { registerElement } from 'nativescript-angular/element-registry';
import { FilterSelect } from 'nativescript-filter-select';
registerElement('FilterSelect', () => FilterSelect);

HTML

    <FilterSelect 
        height="100%"
        [items]="items"
        (change)="onitemselected($event)"
        hint="Please select some items" 
        modal_title="item" search_param="name" 
        primary_key="id">

    </FilterSelect>

Attributes

see demo examples for more information

AttributeDescriptionDefault
renderto render "tags" or "label" or "drop"string : tags
multipleto limit the options selected to one if set to falseboolean : true
search_paramindex of the string value in the items object to search on itstring : name
item_templatexml template for the listview itemsstring : <Label col="0" text="{{ ${this._search_param} }}" textWrap="true" />
changechange event treger when select is donefunction : optional change(args) and selected item can be accessed as args.selected
modal_titletitle of the filter modalString : Please select items
hintstring to show when no items selectedPlease select some items
itemsarray of objects to populate the list of optionsObservableArray :[]
primary_keyunique index of the items objectstring : id
selectedarray of objects to mark some options as selected and it will be the result when select is doneArray: []
disabledto disable select bottonboolean : false
allowSearchto enable/disable search bar in the modalboolean : true
refreshto refresh the filter select with new values good with remote datafunction
searchHintsearch placeholder or hint in the items modal"Search for item"
xbtnremove tag text you can use tag icon here"x"
closeTextclose button text"Close"
doneTextdone button text"Done"
clearTextclear button text"Clear"
selectTextselect button text"Select"
autofocuskeyboard up when you open modal so you can start searchfalse
open()open modal programmaticallyfunction
closeclose event treger when modal is closedyou can get the selected array by args.selected if the modal closed without any selection the array will be empty

CSS core-theme styles is required for modal page if you dont have them just make your own

see styles.css so you can override or make your own

  • and don't forget to share with us your nice styles :D

font icons

  • font icons are required if you are using dropdown render

    and you can add fontawsome icon as a select triger ( hint="{{'fa-list-ul' | fonticon}}" )

    see demo

For contributing

just do a pull request with description of your changes or open issue with your ideas

i need help with this issue

1.3.0

5 years ago

1.2.9

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago