Commit 3bd0aefe authored by bbaer's avatar bbaer

more configuration options

parent 151faada
......@@ -17,8 +17,9 @@ var QfqNS = QfqNS || {};
'use strict';
n.DynamicSearch = function ($hook, api) {
n.DynamicSearch = function ($hook, options) {
this.$container = $hook;
this.minLength = options.minLength || 3;
this.$output = {};
};
......@@ -50,9 +51,11 @@ var QfqNS = QfqNS || {};
};
n.DynamicSearch.prototype._handleKeyUp = function($field) {
if($field.val().length > 3) {
if($field.val().length >= this.minLength) {
console.log("blupp");
this.$output.html($field.val());
var request = $field.val();
}
};
......
......@@ -75,7 +75,10 @@
QfqNS.Log.level = 0;
// Just for mockup, init() function called from new QfqNS.Plugin class maybe.
$(".qfq-dynamic-search").each(function() {
var dynamicSearch = new QfqNS.DynamicSearch($(this), "url-soso");
var dynamicSearch = new QfqNS.DynamicSearch($(this), {
api: "url",
minLength: 3
});
dynamicSearch.display();
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment