Handling click of proxy view in app.js in android module - titanium-mobile

I have created one carousel view using module in android. Here everything is going fine. But how to handle click of individual image in this view. I can handle this easily in my native android code but I need to get listener in my app.js so when one image from carousel will be clicked I will get is name but I have no idea how to achieve this. Here is my code:-
var carouselandroid = require('com.carouselandroid');
var proxy = carouselandroid.createExample({ message : "Creating an example Proxy", width : Ti.UI.FILL, height : Ti.UI.SIZE, });
win.add(proxy);
proxy.addEventListener('click', function(e) { Ti.API.info('--------getting e: ' + JSON.stringify(e)); });
but listener is not called.

As I was unable to get click of proxy so I used fireEvent in my module but again I was unable to pass data using fireEvent may be I need to understand modules more. Nevertheless to achieve this I made one property of proxy in my module and then firing one method. This way it is working.

Related

Trying to disable remove on a per file-pond item basis

I'm investigating adding custom functionality via my own plugins, and here's what I've done so far
Premise
Create a plugin which will disable the remove button for relevant items
Attempted so far
Registered a plugin and during DID_LOAD_ITEM tried the below
const removeItemButtons = el.querySelectorAll('.filepond--action-remove-item');
removeItemButtons.forEach(removeItemButton => {
removeItemButton.setAttribute("disabled", "disabled");
});
But the button is not disabled. The attribute does not appear on the remove button. Am I missing something in the lifecycle on how plugins interact with the DOM? The button does get returned by the querySelector all, is it modified after the plugin is called?
did the removeItemButtons have been rendered before your function? it seems like your selector did not get the items

Clean up DOM after a Firefox add-on SDK extension Disable/Remove action is fired

I am working on a add-on SDK extension which uses a pageMod object with a content script that adds a DIV tag to the DOM (this tag behaves like a button) when the action button is being clicked.
I am trying to find a solution where I can delete that newly added DOM element when the extension is being disabled or removed and I've had no luck so far.
The first thing that I've tried was to use the AddonManager.addAddonListener(listener) approach where I would listen for a onUninstalling or a onDisabling event and then communicate with the content script but I got nowhere.
What I've tried next was to make use of the exports.onUnload solution where I tried to send a message from the pageMod's worker to the content script and deal with the removal of the DIV from there but it seems that the content script is no longer responsive by the time the onUnload function is being triggered.
Is there really no way to clean up the modified DOM when the extension is being disabled/removed?
At your content script listen for the detach event.
self.on("detach", function(reason){
//remove that div
});
In #paa's answer the "port" part is missing:
e.g., from the docs
var oldInnerHTML = window.document.body.innerHTML;
window.document.body.innerHTML = "eaten!";
self.port.on("detach", function() {
window.document.body.innerHTML = oldInnerHTML;
});
I am not using PageMod nd this works for me.

Call a server side MVC action on the click of a Kendo UI button

I just download a trial version of v2013.3.1119.440 of the Kendo UI wrappers for ASP.NET MVC. I see a new Kendo.Mvc.UI.Fluent.ButtonBuilder wrapper in this version that wasn't in the version I had downloaded just 20 days ago on another PC.
The said wrapper represents a button.
I can't see a way to directly wire this Kendo.Mvc.UI.Fluent.ButtonBuilder wrapper with a server side MVC action. How do I do that?
I do see the Events method on the ButtonBuilder class, which accepts a Action<ButtonEventBuilder> events. In the ButtonEventBuilder, I see another method called Click, which has two overloads, but both are for wiring client side event handlers of the button.
I don't see a way to directly wire up a server side call-back/post-back with the button click.
Am I missing something? Is the only way to do it the manual way of firing the server side post back or call back from a JavaScript function?
The Button is new in the latest release of Kendo UI (last week). It doesn't directly support what you're looking for, but something similar could be accomplished like this:
#(Html.Kendo().Button()
.Name("textButton")
.Content("Text button")
.HtmlAttributes( new {type = "button"} )
.Events(ev => ev.Click("onClick")))
Then a JS function similar to this:
function onClick(){
$.ajax({
url: '/controller/action'
data: { // data here }
}).done(function(result){
// do something with the result
}).fail(function() { // handle failure });
}
More info can be found in their demo site: http://demos.kendoui.com/web/button/events.html

“Object doesn't support property or method 'ready'”

Object doesn't support property or method 'ready'
I am getting this error while using custom dropdown list with js mootools slider. I have downloaded js slider and custom dropdown and while trying to merge it, I am facing this error.
I have downloaded the js slider plugin from here:
http://landofcoder.com/index.php?option=com_jdownloads&Itemid=372&task=view.download&cid=6
Can anyone tell me what's wrong with it ?
Make sure what you have mootool and jquery required. You can open Inspector in Google Chrome and type in console tab MooTools and jQuery.
This libraries has conflict on global variable $.
document.id('element_id') // Mootools' "$"
jQuery('selector or something') // jQuery's "$"
I hope in you situation this should help
jQuery(document).ready(function() {
// initialize you code
});

Firefox add-on: Injected HTML

I'm trying to write an add-on for firefox and i'm having a problem-
When the user right-clicking on the page the add-on is adding an element to the page's body using
document.body.appendChild(myElement);
myElement has a button and i want that "onClick" it will call a xmlHttpRequest and handle the response in some why. I've tried to inject the two scripts using
document.getElementsByTagName('head')[0].appendChild(xmlRequestFunction);
document.getElementsByTagName('head')[0].appendChild(handleResponseFunction);
but it didn't work because of (i assume) a security problem.
What can i do?
Thanks
Do not use onclick when working with content, use addEventListener instead (see https://developer.mozilla.org/en/XPCNativeWrapper#Limitations_of_XPCNativeWrapper if you need to know why). Like this:
myElement.addEventListener("click", function(event)
{
var request = new XMLHttpRequest();
...
}, false);

Resources