reset() function called on fine uploader object is not working - file-upload

I wonder what is the proper way to reset FineUploaders uploader to its initial state?
$('#uploader').fineUploader('reset')
This results in "Uncaught TypeError: Cannot call method 'reset' of undefined " in definition of reset function
reset: function() {
this.log("Resetting uploader...");
this._handler.reset();
this._filesInProgress = [];
this._storedIds = [];
this._autoRetries = [];
this._retryTimeouts = [];
this._preventRetries = [];
this._button.reset();
this._paramsStore.reset();
this._endpointStore.reset();
--> this._pasteHandler.reset(); <--
this._netFilesUploadedOrQueued = 0;
},
So it seems that _pasteHandler was not created. Am I missing something in my configuration or is this bug in the uploader itself (which I seriously doubt as I wasn't able to found anyone else with similar issue)
As this is my first encounter with Fine Uploader any advice will be highly appreciated .
Thanks

This DOES appear to be a bug in Fine Uploader 3.4 (released yesterday). It will affect anyone attempting to reset the Fine Uploader instance without the paste to upload feature enabled. Can you please open up a bug report in the Github project's issue tracker so it can be tracked? I'll try to fix this today.
Update: Fixed in 3.4.1.

Related

Quit and Re-join room

I am making a video chat application using simplewebrtc. It is working fine with one call.After hanging up(webrtc.leaveRoom()) when I try to call again then it is not working.It is not executing webrtc.on('readyToCall', function() {
console.log('Ready to call');
webrtc.joinRoom(room);
});
So how can I ressolve this issue? Is there any issue with my old connection?
I found the solution.
I made changes inside simplewebrtc. I changed the file
/node_modules/simplewebrtc/src/simplewebrtc.js. I just remove comments from line 'force new connection': true.(I will never recommend this).
Now this line looks like socketio: { 'force new connection': true } and it is working.
thanks.

JS not loading php into div, website specific behaviour

I have two joomla applications se up with exactly the same versions, the same global configuration settings, and I set up a test application with the following function to load a php into a div on a specific page..
function getDiv(str) {
var id = document.getElementById("appselector").value;
if (id == "") {
document.getElementById("scoffitcategoryedit").innerHTML = "";
return;
}
else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp3 = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp3.onreadystatechange = function() {
if (xmlhttp3.readyState == 4 && xmlhttp3.status == 200) {
document.getElementById("scoffitcategoryedit").innerHTML = xmlhttp3.responseText;
alert("WTF");
}
};
xmlhttp3.open("GET","index.php?option=com_jumi&fileid=23& format=raw&" + str + id, true);
xmlhttp3.send();
}
}
I know its a little long winded, but the problem is that the script works fine in one website, but not in the other. Both of them are loading the same versions of jquery (which as you can see I don't like using), and both have the same templates. The only clue I seem to have found is that when I have text links elsewhere on the site attached with query statements pointing to self (index.php?blastr=bla&drivelstr=drivel), the browser shows index.php/ prepended to the link mentioned above.
I debugged the script and in the non functioning website it hangs on the xmlhttp3.send line.
I know people espouse the beauty of jquery's load() function as a replacement for this, but I cant get it to work (probably because the templates are using jquery versions higher than 1.8.1 when it was deprecated). So i'd rather stick with base js.
Any ideas about this inconsistent behaviour ?
This should be a comment but can't yet :(
I would check your configuration file for this line:
public $live_site = '';
and see if there is something in the failing site besides ''.
I found out what it was, I must have actually installed two different versions of the Jumi application in my websites. one website had a file under components/com_jumi/views/application named view.raw.php while the other did not. This meant that the format=raw in the index.php string could not be interpreted and caused a null response.
I simply copied the file into the other website where it was missing and everything then worked fine. But thanks for the response.

Angular Datatables: cannot call destroy/edit function

I cannot access the API methods mentioned in this doc, as well as the destroy method described here .
the HTML:
<table datatable dt-instance="dtInstance" dt-options="dtOptions" dt-columns="dtColumns" class="table-striped">
</table>
In my controller I have:
a.dtInstance = {};
var getTableData = function() {
var deferred = $q.defer();
deferred.resolve(tablecontent_array);
return deferred.promise;
};
a.dtOptions = DTOptionsBuilder.fromFnPromise( getTableData())
.withPaginationType('full_numbers');
a.dtColumns = [
DTColumnBuilder.newColumn('id').withTitle('ID').notVisible(), //
DTColumnBuilder.newColumn('groupby').withTitle('Group By').notSortable(),
DTColumnBuilder.newColumn('value').withTitle('value').notSortable()
]
'tablecontent_array' contains the data.
When I try to modify/destroy the table I get an error.
a.dtInstance.rerender()
Error message:
TypeError: a.dtInstance.rerender is not a function
My aim is to modify the table after certain user operations. The table data in rendering fine. But I cannot access any of its API methods.
May be I am doing some mistake while doing so, I am new to angular-datatable, any help/suggestions regarding this issue will be helpful.
After dwelling into the question for days I tried creating plnkr as suggested in the comment. It turns out I was not using the correct versions of datatables, Angular and host of other Libraries. Corrected that and the issue was resolved.
Even then my objective of adding/appending new column(s) was not resolved in angular way. However some folks posted possible solutions using jquery datatables.

Exception Error: chrome://app/content/app1.js - EXPORTED_SYMBOLS is not an array

"EXPORTED_SYMBOLS is not an array" Exception flagged when tried to use Components.utils.import("chrome://app/content/app1.js");.
I have a XUL application created and from one of the JS File(say app.js) I tried to include the other JS File as shown above.
Both app.js and app1.js are placed in content folder and also in chrome.manifest file following line is added
"content app content/"
In other JS File (app1.js), I have exported symbols like
var EXPORTED_SYMBOLS = ["Fooinstance"];
var Fooinstance = {
foo: function() {
...
}
}
In app.js,
Components.utils.import("chrome://app/content/app1.js");
// Error: chrome://app/content/app1.js - EXPORTED_SYMBOLS is not an array
...
Fooinstance.foo();
I am running this XUL app on XULRunner 17.0.1 win32 libraries.
I looked through the code in this link https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Using
It did not help and if I include it as resource it works however I do not want to include it as part of resource.
Could you someone point out what mistake would be ?
I had this same problem, and I solved it:
1) changing the file extension (.js) by .jsm
2) Adding a first line on your module exporting classes to share. EG:
var EXPORTED_SYMBOLS = ["Xobject"];
function Xobject(){
}
Xobject.prototype.stop = function() {
return 'stop';
}
Xobject.prototype.run = function() {
return 'running';
}
3) Calling this way
Components.utils.import('resource://gre/modules/Services.jsm' );
Components.utils.import("chrome://myFirstAddOn/content/Xobject.jsm");
var myXobject = new Xobject();
alert(myXobject.run());
Hope it help u
For anyone else getting this, another possible reason is a circular dependency. My case was a little different, but I had two JSM files each using Components.utils.import to import each other. Then I got this error in one of them.

Where are working dojox.storage AMD examples?

I can't seem to find dojox.storage documented somewhere recently. Is dojox.storage broken in 1.7 (AMD)? It appears the unit-tests aren't even working. The example at /dojo-release-1.7.2-src/dojox/storage/tests/test_storage.html doesn't seem to work at all on FF or IE.
What is the recommended approach to using a local storage? In our case we'd like to use HTML5 storage that falls back on cookie storage when not available.
Below example from http://dojotoolkit.org/reference-guide/1.8/dojox/storage.html It's working on Dojo 1.7 and above.
dojo.require("dojox.storage");
var storageProvider=null;
dojo.addOnLoad(function(){
dojox.storage.manager.initialize();
storageProvider=dojox.storage.manager.getProvider();
storageProvider.initialize();
var myObject={key1:true};
storageProvider.put("myValue", myObject, function(status, keyName){
alert("value put in "+keyName);
});
});
According to http://dojotoolkit.org/reference-guide/1.8/dojox/storage.html and http://bugs.dojotoolkit.org/ticket/14465, dojox.storage isn't expected to work with AMD and won't be for a while.
That said, this did work for me in dojo 1.8.3:
require(["dojox/storage", "dojo/ready"], function (storage, ready) {
ready(function() {
var storageProvider = dojox.storage.manager.getProvider();
storageProvider.initialize();
var vals = storageProvider.get("InventoryMainSelectionHistory");
var i = 1;
});
});
As for DoJo 1.9.2, dojox.storage test (/dojox/storage/tests/test_storage.html) wasn't working. After nearer inspection it happened to be initialization issue in that particular code:
// wait until the storage system is finished loading
dojo.addOnLoad(function(){
// is the storage already loaded?
if(dojox.storage.manager.isInitialized() == false){
dojo.connect(dojox.storage.manager, "loaded", TestStorage, TestStorage.initialize);
}else{
dojo.connect(dojo, "loaded", TestStorage, TestStorage.initialize);
}
});
The listener has registered waiting for event "loaded" on dojo, that wasn't called in newer DoJo version. After changing the code:
dojo.addOnLoad(function(){
TestStorage.initialize();
});
the example functions (for LocalStorageProvider) in both FireFox and IE 10.