Skip to content

rexgnu/riotjs-ajax-typeahead

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-ajax-typeahead

Diving into React and trying to build a simple AJAX backed typeahead

Work in progress.

Develop

Usage

Basic

React.render(
    <TypeAheadSelect
        name="inputName"
        url="/data?search="/>,
    document.getElementById('demo')
);

BYO filter-function

function rawMatcher(raw, searchStr) {
    return raw.filter(function (c) { return c.text !== 'One' });
}

React.render(
    <TypeAheadSelect
        name="inputName"
        url="/data?search="
        filter={rawMatcher} />,
    document.getElementById('demo')
);

BYO AJAX

function xhr(searchStr, cb) {
    cb([{ text: 'asda', value: 1 }]);
}

React.render(
    <TypeAheadSelect
        name="inputName"
        xhr={xhr} />,
    document.getElementById('demo')
);

License

ISC

About

Simple AJAX backed typeahead

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published