adding Jquery plugin jquery.autoSuggest.js to OTRS

English! place to talk about development, programming and coding
Post Reply
giliann13
Znuny newbie
Posts: 6
Joined: 15 Mar 2012, 10:46
Znuny Version: 3_0_10
Real Name: Dmitry Bilichenko

adding Jquery plugin jquery.autoSuggest.js to OTRS

Post by giliann13 »

Hello! Could anyone hellp me with adding plugins? I working on Location Map (Yandex map api). When i added jquery.autoSuggest.js as script (or correct in XML ) and use this code

Code: Select all

$("input[type=text]").autoSuggest(data.items, {selectedValuesProp: "name", 
                                                            selectedItemProp: "name", 
                                                            searchObjProps: "name", 
                                                            selectionLimit: 1, 
                                                            resultClick: function(data){
																map.removeAllOverlays();
	                                                            var point = new YMaps.GeoPoint(data.attributes.lon, data.attributes.lat);
	                                                            var placemark = new YMaps.Placemark(point);
																placemark.name = data.attributes.name;
																placemark.description = data.attributes.value;
																map.addOverlay(placemark);
																map.panTo(point, {flying: 1});
                                                            }
            });

and this code for addin text input

Code: Select all

function locationSearchBox () {

            // Добавление на карту
            this.onAddToMap = function (map, position) {
                    this.container = YMaps.jQuery("<ul></ul>")
                    this.map = map;
                    this.position = position || new YMaps.ControlPosition(YMaps.ControlPosition.TOP_RIGHT, new YMaps.Size(10, 10));

                    // Выставление необходимых CSS-свойств
                    this.container.css({
                        position: "absolute",
                        zIndex: YMaps.ZIndex.CONTROL,
                        background: '#fff',
                        listStyle: 'none',
                        padding: '10px',
                        margin: 0
                    });
                    
                    // Добавление окошка поиска
                    this._addSearchBox();
                    
                    // Применение позиции к управляющему элементу
                    this.position.apply(this.container);
                    
                    // Добавление на карту
                    this.container.appendTo(this.map.getContainer());
            }

            // Удаление с карты
            this.onRemoveFromMap = function () {
                this.container.remove();
                this.container = this.map = null;
            };

            // Пока "летим" игнорируем клики по ссылкам
            this.isFlying = 0;

            // Формирование списка офисов
            this._addSearchBox = function () {
                var _this = this;
				var search = YMaps.jQuery("<input type='text'>");
	            search.appendTo(_this.container);
            };
    }
i've got ERROR Uncaught TypeError: Object #<Object> has no method 'autoSuggest'

how can i fix it?
Post Reply