Skip to main content

Subscriber in glue.js is not getting invoked for yahoo autocomplete widget

5 replies [Last post]
vinayajax
Offline
Joined: 2008-07-21
Points: 0

Hi All,

I am facing a problem, subscriber in glue.js for yahoo autocomplete widget is not getting invoked when i use service attribute to provide data to autocomplete widget whereas it is getting invoked when i use value attribute to provide data to widget.

Content of Try.jsp with service attribute:

Content of Try.jsp with value attribute :

Content of Data.jsp :
<%
out.println("");
out.println("");
out.println("NewYork");
out.println("");
out.println("");
%>

Content of glue.js :
jmaki.subscribe("/yahoo/autocomplete/*", function(args) {
var test = args.value;
alert("In subscriber, test : " + 'test');
});

What i found is that in init method of component.js file for yahoo autocomplete widget, value of variable i is coming undefined in case of service attribute and it's value is object in case of value attribute.

Some part of init method in component.js of yahoo autocomplete widget :
_widget.nativeWidget.itemSelectEvent.subscribe(function(ev,item,o){
alert("item -" + item);
//item[2][1] = "NY";
var i=vmappings[item[2][1]];
alert("value of i in init is : " + i);
// alert("Item Contents : " + item[0][0]+","+item[0][1]+","+item[0][2]+","+item[1][0]+","+item[1][1]+","+item[1][2]+","+item[2][0]+","+item[2][1]+","+item[2][2]);
processActions(i, i.targetId, item[2][1]);

// alert(check3);
});

Can anybody help me why it is not working for service attribute whereas it is working for value attribute.Thanks in advance.

Regards,
Vinay

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sloanb
Offline
Joined: 2003-09-14
Points: 0

I am looking into adding the ability to add custom filters to the autocomplete widgets. This would allow you to call a custom filter (function) that filters the incoming data and you could add the action at that time.

[b]Example Filter Used in jmaki Blocklist: [/b]

[code]
jmaki.widgets.jmaki.blockList.RssFilter = function(_in) {
var maxLength = 100;
var _rows = [];

for (var _i=0; _i < _in.channel.items.length;_i++) {
var _des = _in.channel.items[_i].description;
if (_des.length > maxLength) {
_des = _des.substring(0, maxLength) + "...";
}
var row = {
title : _in.channel.items[_i].title,
link : _in.channel.items[_i].link,
date : _in.channel.items[_i].date,
description : _des,
content : _in.channel.items[_i].content
};
_rows.push(row);
}
return _rows;
}
[/code]

Looking at this code hopefully you can see where this could become useful. Let me know your feedback.

Regards,
--Sloan

rambomogambo
Offline
Joined: 2008-06-05
Points: 0

Sloab/Vinay

I am running intop the exact same issue you guys have been discussing here.

I am attempting to fill an autocomplete widget with state info., and based on the state the user selects I want to help load another autocomplete with assocaited cities.

My glue code for onSelect will not run if I use the service tag to load the state values. I need some help to get me past this issue.

In my jsp I have ...

In my glue code I have ...
jmaki.subscribe("/state/onSelect", function(args) {
alert("/state/onSelect!");
});

But when I select the state, this code doesnt run; It however does if I hardcode the values instaead of using the service.

sloanb
Offline
Joined: 2003-09-14
Points: 0

I apologize I haven't had time to look into this. I will put it on my priorities for you guys. I'll let you know.

rambomogambo
Offline
Joined: 2008-06-05
Points: 0

Ok,

I just an FYI ... I tried a few other widgets and they all seem to have an issue! For eg. ... I tried the inline edit widget, in this case I have the value hardcoded and I tried to publish to a topic ...

The handler in my glue code...
jmaki.subscribe("/editJingle/*", function(args) {
alert("/editJingle/* !");
});
never gets called!

sloanb
Offline
Joined: 2003-09-14
Points: 0

This is due to the fact that the processActions is expecting a payload with an action. Using the service does not pass this back to the widget which causes the processActions not to run. I'll see what it would take to get this implemented and let you know. Thank you for the heads up.