Why does second load of this dart:js date picker code error? - datepicker

I use the following code in dart (chrome app):
js.context.callMethod(r'$', ['.datepicker']).callMethod('datepicker', [new js.JsObject.jsify({'format':'yyyy-mm-dd'})]);
which works fine the first time this code is rendered. However, if I navigate away and back to the page, I get the following error:
Uncaught Uncaught Error: NullError: Cannot call "split" on null
Stack Trace:
TypeError: Cannot read property 'split' of undefined
at Object.DPGlobal.parseDate (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/js/bootstrap-datepicker.js:393:20)
at Datepicker.update (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/js/bootstrap-datepicker.js:161:25)
at new Datepicker (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/js/bootstrap-datepicker.js:84:8)
at HTMLDivElement.<anonymous> (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/js/bootstrap-datepicker.js:341:38)
at Function.n.extend.each (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/js/jquery-2.1.3.min.js:2:2882)
at n.fn.n.each (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/js/jquery-2.1.3.min.js:2:847)
at $.fn.datepicker (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/js/bootstrap-datepicker.js:336:15)
at JsObject.callMethod$2 (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/b2015.dart.js:19892:42)
at navAccTranS24_closure.call$1 (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/b2015.dart.js:23116:58)
at _RootZone.runUnary$2 (chrome-extension://lgndonjnifhllkkomohiinkfdaphgalc/b2015.dart.js:10124:18)
By navigate I mean I use children.clear() on the holding div the re-populate it with new html.
I presume I should only run this code once, or 'unload' it when I navigate away but I am just guessing here and would appreciate a solution.

Related

Nwjs how to use evalNWBinModule in another created window?

In the main window I write the following code and it works:
nw.Window.get(null).evalNWBinModule(null, "./my.bin", "./my.js");
import("./my.js");
but if I create a new window via nw.Window.open(MyOtherURL); where I then move this code, then after running I get an error:
Uncaught (in promise) TypeError: Failed to resolve module specifier
'./my.js'
what is the launch difference and what else do i need to configure?
nw.Window.get() returns a reference to the Window itself, so you can then chain off of it.
nw.Window.open(), does not, but it does have a callback function gives you access to the new window, which you can chain off of.
const url = 'page2.html';
const options = {};
nw.Window.open(url, options, function (win) {
win.evalNWBinModule(null, './my.bin', './my.js');
});
However I'm not sure that will do what you want. You will likely be better off having the code run in your page2.html file directly.

IONIC-4 Navigation - how get parameter passed

Iam new to Ionic - 4.
I have function which is navigated to my items page.
gradeItem = function(data){
this.navCtrl.navigate('grade/items', {data:data});
}
and it is successfully navigating.
Now I want to access my parameter data from my items.page.ts file.
can anyone please help me on this.I tried navParams but it throwing error like
ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[ItemsPage -> NavParams]:

Call to a member function get_cart_subtotal() on a non-object in config-woocommerce/config.php on line 790

I'm trying to login into my WordPress Admin panel, and am getting the following error:
Call to a member function get_cart_subtotal() on a non-object in /home/spicom/public_html/adwinang.com/wp-content/themes/enfold/config-woocommerce/config.php on line 790
This is my code at line 790:
$cart_subtotal = $woocommerce->cart->get_cart_subtotal();
It sounds like you haven't called global $woocommerce;, before trying to access the $woocommerce object.
A better way would be to use WC():
$cart_subtotal = WC()->cart->get_cart_subtotal();
Alternatively, it's possible the WooCommerce hasn't even been installed and activated...make sure to do that, if it's a theme dependency.
I had a very similar message.
[25-Sep-2018 10:24:08 UTC] PHP Fatal error: Uncaught Error:
Call to a member function get_cart_subtotal() on null in
themes\storefront\inc\woocommerce\storefront-woocommerce-template-functions.php:80
It was due to me having the following in my wp-config.php file.
define( 'DOING_CRON', false );
I'd added this line while attempting to run something from the command line with W3 Total Cache activated. I didn't realise that it would completely ruin WooCommerce and didn't notice the side effect until attempting to view the site in my browser.

Meteor error in trying to use collections

I am currently pulling data from collections in the MongoDB but there are 2 in particular that will not work either giving me the following error:
Exception from sub Assets id i574gxNDc9RdHERNn TypeError: Cannot call method 'find' of undefined
Or:
TypeError: Cannot call method 'attachSchema' of undefined
Or:
Object # has no method 'attachSchema'
depending on how I configure it. Does anyone have an idea of what I am doing wrong. I am using the same code for the ones that work as well as the ones that are throwing errors.
The collection looks like this:
Assets = Collections.Assets = Meteor.Assets;
Querying in server/publish.js:
Meteor.publish("Assets", function (){
return Meteor.Assets.find({});
});
Changing it to:
new Mongo.Collection('Assets');
Gives error:
Exception from sub Assets id ZgzZyNYPmMr5gtFGn TypeError: Cannot call method 'find' of undefined
Running the following from the command line in the top (root) directory of the project might fix this (it helped me):
meteor add aldeed:collection2

"SyntaxError: JSON.parse: unexpected character" error on loading jqxgrid in zend

I am using zend with jqxgrid.
While navigating to the page(eg: test.com/employee) containing jqxgrid, the grid simply works and loads the required data to the grid.
But when I try to navigate the same page by passing the parameter(eg: test.com/employee/id/1), the grid doesnot load.
I’ve used loadError on the dataAdapter as below and printed the error
var dataadapter = new $.jqx.dataAdapter(source,{
loadError: function (xhr, status, error) { alert(‘Status=’+status+’, Error=’+error); }
});
The result of the alert is shown as: “Status=parsererror, Error=SyntaxError: JSON.parse: unexpected character”
I want to load the grid according to the “id” passed through navigation URL but its not working.
So, what is the solution to this problem?
Does the jqxgrid takes the parameter /id/1 from the navigation URL while calling ajax?
Thank you in advance.
Check your JSON output. There is a difference in it for each case.
If could be that your JSON is invalid:
One character before
One character after
A BOM character somewhere there
Your JSON is NOT UTF-8?
This was due do the routing error.
When I replaced the navigation URL test.com/employee/id/1 with test.com/employee?id=1 , it worked as expected.