- });
-
- $dummy.on('paste', function(){
- setTimeout(function() {
- handle_changed_text();
- }, 1);
- });
-
- $dummy.blur(function(){
- window.clearTimeout(timer);
- timer = window.setTimeout(annotate_state, 100);
- });
+ },
+ open_dialog: function() {
+ new ns.PickerPopup(this);
+ },
+ init: function() {
+ var self = this;
+ this.$dummy.autocomplete({
+ source: function(req, rsp) {
+ $.ajax($.extend(self.o, {
+ url: 'controller.pl?action=Part/ajax_autocomplete',
+ dataType: "json",
+ data: self.ajax_data(req.term),
+ success: function (data){ rsp(data) }
+ }));
+ },
+ select: function(event, ui) {
+ self.set_item(ui.item);
+ },
+ search: function(event, ui) {
+ if ((event.which == KEY.SHIFT) || (event.which == KEY.CTRL) || (event.which == KEY.ALT))
+ event.preventDefault();
+ },
+ open: function() {
+ self.autocomplete_open = true;
+ },
+ close: function() {
+ self.autocomplete_open = false;
+ }
+ });
+ this.$dummy.keydown(function(event){ self.handle_keydown(event) });
+ this.$dummy.on('paste', function(){
+ setTimeout(function() {
+ self.handle_changed_text();
+ }, 1);
+ });
+ this.$dummy.blur(function(){
+ window.clearTimeout(self.timer);
+ self.timer = window.setTimeout(function() { self.annotate_state() }, 100);
+ });