1.2.27 • Published 5 years ago

d1lookup v1.2.27

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

DEPRECATED - d1lookup

This is no longer maintained.
Please consider using d1-web instead.


Add-on for d1.
Autocomplete lookups with data from XHTTP request.
Demo & docs

Install

npm install d1lookup

Usage

On page load call:

d1lookup.init(options);

In your markup:

  • Add data-lookup attribute with value that is data source URL to load autocomplete data. URL should have {q} substring that will be replaced with search string.
  • Add data-label attribute with label for initial value.
  • Add data-cache attribute to set limit of cached responses from data source. By default cache is not used.
  • Add data-url attribute to add link to selected resource. URL should have {id} substring that will be replaced with identifier of selected resource.
  • Add data-goto attribute to go to specified URL on item selection. URL may have {id} substring that will be replaced with identifier of selected resource.

Example

<input type="text" name="id" value="1"
	data-lookup="?table=users&q={q}"
	data-label="User One"
	data-cache="10"
	data-url="/users/{id}"
	data-goto="/users/{id}">

Options

attrGoto

Input attribute, containing URL to visit on item selection, with optional {id} substring.
Default: "data-goto"

attrLabel

Input attribute, containing label for initial input value.
Default: "data-label"

attrLookup

Input attribute, containing data source URL with {q} substring.
Default: "data-lookup"

attrUrl

Input attribute, containing link to selected resource with {id} substring.
Default: "data-url"

cacheLimit

Limit of cached responses from data source.
Default: 0

icon

Icon to show after input as a link to selected resource.
Default: "edit"

listId

Id of popup list element containing found autocomplete options.
Default: "lookup-list"

max

Maximum options to show.
Default: 10

wait

Timeout before actual request after search string input, ms.
Default: 300

Browser Support

  • IE 10+
  • Latest Stable: Chrome, Firefox, Opera, Safari

License

MIT

1.2.27

5 years ago

1.2.26

6 years ago

1.2.24

6 years ago

1.2.25

6 years ago

1.2.23

6 years ago

1.2.22

6 years ago

1.2.21

6 years ago

1.2.20

6 years ago

1.2.19

6 years ago

1.2.18

6 years ago

1.2.17

6 years ago

1.2.16

6 years ago

1.2.15

6 years ago

1.2.14

6 years ago

1.2.12

6 years ago

1.2.11

6 years ago

1.2.10

6 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

7 years ago

1.2.2

7 years ago

1.2.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago