diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..14bc68c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/nbproject/private/
\ No newline at end of file
diff --git a/dist/jquery.bootcomplete.js b/dist/jquery.bootcomplete.js
index 25e6c10..9903357 100644
--- a/dist/jquery.bootcomplete.js
+++ b/dist/jquery.bootcomplete.js
@@ -18,8 +18,11 @@
idField : true,
idFieldName : $(this).attr('name')+"_id",
minLength : 3,
+ id: 'id',
+ label: 'label',
dataParams : {},
- formParams : {}
+ formParams : {},
+ select: function(item) {}
}
var settings = $.extend( {}, defaults, options );
@@ -77,12 +80,16 @@
success: function( json ) {
var results = ''
$.each( json, function(i, j) {
- results += ''+j.label+''
+ results += ''+j[settings.label]+''
});
$(that).next('.'+settings.menuClass).html(results)
$(that).next('.'+settings.menuClass).children().on("click", selectResult)
$(that).next('.'+settings.menuClass).show()
+
+ if(json.length == 0) {
+ settings.handleEmpty();
+ }
}
})
@@ -104,6 +111,11 @@
//ensure we trigger the onchange so we can do stuff
$(that).prev('input[name="' + settings.idFieldName + '"]').trigger('change');
}
+ } else {
+ var item = {};
+ item.id = $(this).data('id');
+ item.label= $(this).data('label');
+ settings.select(item);
}
$(that).next('.' + settings.menuClass).hide();
return false;
@@ -112,4 +124,4 @@
return this;
};
-}( jQuery ));
+}( jQuery ));
\ No newline at end of file
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 0000000..da97eba
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,3 @@
+files.encoding=UTF-8
+site.root.folder=
+source.folder=
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 0000000..6812457
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,9 @@
+
+
+ org.netbeans.modules.web.clientproject
+
+
+ bootcomplete.js
+
+
+