Cannot read property 'sumo' of undefined - sumoselect.js

I have a sumoselect field with active multiple choices. The input is correctly loaded and it works. I have a problem with methods. I get the undefined error Uncaught TypeError: Cannot read property 'sumo' of undefined.
For example this works
$('.js-selectsumo-filter').SumoSelect();
and this returns the error
$('js-selectsumo-filter')[0].sumo.unload();.
Sumoselect.js is first initialized and afterwards I call my custom js file. I am using jQuery 3.3.1.
$('.js-selectsumo-filter').SumoSelect({
placeholder: placeholder,
csvDispCount: 5,
selectAll: false,
search: true
});

I've managed to find a solution how to call a method without click function as shown in the documentation.
$('.your-class-or-id').SumoSelect().sumo.selectItem('test');
selectItem can be exchanged for any other method available.

Related

ERROR on Populate RadAutoCompleteTextViewComponent

I got the error bellow on trying to populate a RadAutoCompleteTextView.
Any hint in regard?
Many thanks in advance
#ViewChild("rankingsCtrl", { static: false }) rankingsCtrl: RadAutoCompleteTextViewComponent;
this.rankingsCtrl.autoCompleteTextView.insertTokenAtIndex(new TokenModel("Test",""), 0);
JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'addTokenModelAt' of undefined
JS: TypeError: Cannot read property 'addTokenModelAt' of undefined
JS: at RadAutoCompleteTextView.push.../node_modules/nativescript-ui-autocomplete/ui-autocomplete.js.RadAutoCompleteTextView.insertTokenAtIndex (file:///node_modules/nativescript-ui-autocomplete/ui-autocomplete.js:589:0)
It's not recommended to access an element or it's methods upon ngOnInit as it's not guaranteed the underlaying nativeElement is created.
Try to use loaded event of the component which ensures the elements are created. A timeout may work but I wouldn't suggest it as it's not guaranteed all the time.
If you like to access multiple elements, then waiting for parent view's loaded event should be enough, all child elements should be created and ready for use by then.

How to fix "Cannot read property 'apply' of undefined" trying to get the location using Protractor?

I'm trying to get an element's location using the Protractor (v6.0.0) method call getLocation(), however I'm getting the following exception:
TypeError: Cannot read property 'apply' of undefined
at <Jasmine>
at actionFn (/usr/lib/node_modules/protractor/built/element.js:95:44)
at <Jasmine>
at actionResults.getWebElements.then(/usr/lib/node_modules/protractor/built/element.js:468:44)
at <Jasmine>
at ElementArrayFinder.applyAction_(/usr/lib/node_modules/protractor/built/element.js:466:29)
Any clue how to resolve the issue?
Actually my code is really simple.
it('should compare login page with a baseline', async () => {
let input = element(by.id('mat-input-1'));
await input.getLocation();
});
I expect the coordinates of the input which has id mat-input-1, but unfortunately I'm getting that exception.
Protractor's CHANGELOG.md has a link to the selenium-webdriver CHANGELOG, it lists:
Changes for W3C WebDriver Spec Compliance
Replaced WebElement.getSize() and WebElement.getLocation() with a
single method, WebElement.getRect().
So it looks like you should use .getRect().
Now for Protractor 6 itself, this is clearly an issue with documentation. We recommend using 5.4.2 for now.

Why do I get error when trying to add file attachments?

I am trying to use the method addFileAttachmentAsync() in office.js library.
This is the signature of the method I am using:
item.addFileAttachmentAsync(uploadLink, fileJson.name, { asyncContext: null }, function (asyncResult) { });
uploadLink is a string and here is an example of a file I'm trying to upload: https://xdr.purequad.com:6443/files/1b783908-a259-4839-93e2-18fe3248b943_moto.pdf.xdr
The file above is about ~3MB, but when I use a file under 1MB everything works perfectly.
Afterwards it throws this Exception :
Line: 9
Error: Unable to get property 'isInstanceOfType' of undefined or null reference
Also I have to mention this behavior happens only in IE11, while Google Chrome does not throw any exception at all and still does not work.
EDIT: The function was being interrupted before it ended properly! Check my comment.
I have solved the issue myself. When using addFileAttachmentAsync() because it's an async call one should never interrupt the task-pane with Office.context.ui.closeContainer() which was my case. Otherwise it will generate unexpected behavior.

An error occurred while attempting to process /view/ajax: Cannot read property 'length' of undefined

Getting this error on a Drupal view exposed filter when i change the value on the select list. Tried every combination of jquery and jquery UI. Traced the call stack to misc/ajax.js:
Error
at alert (<anonymous>:4:15)
at Drupal.ajax.eventResponse (ajax.js?v=7.36:262)
at HTMLInputElement.<anonymous> (ajax.js?v=7.36:178)
at HTMLInputElement.dispatch (jquery.min.js?v=1.10.2:5)
at HTMLInputElement.v.handle (jquery.min.js?v=1.10.2:5)
at Object.trigger (jquery.min.js?v=1.10.2:5)
at HTMLInputElement.<anonymous> (jquery.min.js?v=1.10.2:5)
at Function.each (jquery.min.js?v=1.10.2:4)
at $.fn.init.each (jquery.min.js?v=1.10.2:4)
at $.fn.init.trigger (jquery.min.js?v=1.10.2:5)
i figured it out - it was some of my application code changing the array prototype. creating a "compare" array prototype basically breaks the ajax/views functionality.

Angular2-meteor cant read property "meteorInstall"

I'm converting an old angular2 project over to use meteor to act as an admin panel style thing for a project that is based off the ionic2-meteor whatsapp tutorial.
So I'm building the website in the client folder inside api.
I'm pretty sure I've got things correct (based off the old socially tutorial) for the angular2 client.
I'm getting these as errors though.
modules.js:13538 Uncaught SyntaxError: Unexpected token export
es5-shim.js:17 Uncaught TypeError: Cannot read property 'meteorInstall' of undefined
at es5-shim.js:17
at es5-shim.js:2789
promise.js:17 Uncaught TypeError: Cannot read property 'meteorInstall' of undefined
at promise.js:17
at promise.js:582
ecmascript-runtime.js:17 Uncaught TypeError: Cannot read property 'meteorInstall' of undefined
at ecmascript-runtime.js:17
at ecmascript-runtime.js:4630
babel-runtime.js:17 Uncaught TypeError: Cannot read property 'meteorInstall' of undefined
at babel-runtime.js:17
at babel-runtime.js:160
random.js:18 Uncaught TypeError: Cannot read property 'meteorInstall' of undefined
at random.js:18
at random.js:368
I imagine that I have probably missed an import or something somewhere but can't work out where.
Any help would be awesome.
These are the packages I have installed.
meteor-base#1.0.4
mobile-experience#1.0.4
mongo#1.1.15
reactive-var#1.0.11
jquery#1.11.10
tracker#1.1.2
standard-minifier-css#1.3.3
standard-minifier-js#1.2.2
es5-shim#4.6.15
ecmascript#0.6.3
shell-server#0.2.2
angular2-compilers
barbatus:typescript
accounts-base#1.2.14
npm-bcrypt#0.9.2
accounts-password#1.3.4
reywood:publish-composite
http#1.2.11
alanning:roles
check#1.2.4
dispatch:mocha-phantomjs
tmeasday:publish-counts
hwillson:stub-collections
practicalmeteor:mocha
xolvio:cleaner
~Edit
///the error comes from #angular/http module, I'm going to try rolling it back to see if it helps.
/**
* \#experimental
*
*/
export var QueryEncoder = (function () {//<---- this is the line causing the error
function QueryEncoder() {
}
QueryEncoder.prototype.encodeKey = function (k) { return standardEncoding(k); };
QueryEncoder.prototype.encodeValue = function (v) { return standardEncoding(v); };
return QueryEncoder;
}());
rolling back and forward didn't help at all.
I had the same problem. For me it was due to recently installed ionic plugin. It has started working normal after removing that plugin. Please try removing your recently added plugin. I hope you have tried that by now.

Resources