I used a bokeh datatable in a simple report I had, which had the lines of:
source = ColumnDataSource(df)
callback = CustomJS(args=dict(callback_args), code="""some JS code""")
source.callback = callback
I had a simple JS code that would change some other datasources. Clicking on each row of the datatable would trigger it and it worked fine.
I upgraded bokeh to version 2.2.1
And now this code doesn't work anymore.
It seemed that for a datatable I might need to use something like:
source.js_on_change('value', callback)
or maybe:
source.js_on_change('start', callback)
But it doesn't work and the error I get is:
Uncaught (in promise) TypeError: Cannot read property 'connect' of undefined
at f.connect
at f._update_property_callbacks
at f.connect_signals
at Function._initialize_references_json
I wonder if I am doing something wrong or is it possible that it's a bug in bokeh?
Might be a bug with Bokeh. Take a look at this issue: https://github.com/bokeh/bokeh/issues/10345
Not a bug. ColumnDataSource has neither a start property nor a value property. You can only add callback handlers for properties that exist. You probably want
source.selected.js_on_change('indices', ...)
Related
I have multiple classes in my HTML named ".slider" and I want to use dojo query to get these classes so that I can do a .forEach on each node.
This is what I had:
query('.slider').forEach(function(node){
do something
})
For some reasons it keeps saying that TypeError: query(...).forEach is not a function.
When I consolelogged my query('.slider'), I was expecting a node list but what showed on the browser was like:
What is going wrong?
Just re-checked the dojo.query documentation and it looks like I need to use dojo.query instead of .query because I am on a lower version
Im working on a project to build a CRUD system using knockout and getting and saving my data via AJAX. Been having issues binding the select dropdown. When I try to edit an incident I get the following error:
Uncaught TypeError: Cannot read property 'push' of undefined
I created a jsfiddle http://jsfiddle.net/rqwku4kb/20/ to demonstrate the issue. I'm still working on the delete and add a new incident link so they are not working yet but im working on that seperately.
Here is the code that`s causing me issues at the moment.
self.ShowMeTheCurrentSelectedIncident = function(data) {
self.currentIncident();
self.chosen_composante.push([data.Composante]);
};
Would anyone have have any idea where the issue might be or be able to provide me some advice?
The method here is what's wrong:
self.ShowMeTheCurrentSelectedIncident = function(data) {
self.currentIncident(); // (1)
self.chosen_composante.push([data.Composante]); // (2)
};
What this does:
(1) get the value of the observable currentIncident and then throw it away. It's always null and never set so this is doubly redundant.
(2) Reference an undefined variable called chosen_composante which does not exist in IncidentList.
I could not fix this for you since I wasn't sure what values were to go where, but it should be enough to set you on the right track - you're confusing the properties of the IncidentList and Incident
After i include the bootstrap.js
<script type="text/javascript" src="/js/bootstrap/js/bootstrap.js"></script>
I get followning error in the console:
Uncaught TypeError: Cannot read property 'documentElement' of null
The boots collapse works just fine but the console get spammed this error.
I have included jquery before bootstrap.
Anyone else had this problem before?
Edit:
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
if (e.isDefaultPrevented() || !inDom) return
var that = this
this is a snipet from the bootstrap.js script.
It seems the error comes always in the tooltip function in the var inDom line at the documentElement part
You most likely have another tooltip library still in use (like JQueryUI/Tooltip) OR you're trying to attach a tooltip directly to the document element. Please look into your code for something like:
$(document).tooltip
or something like that, and remove it in order to make things work again. Be sure to review every other .tooltip() call you might already have, since they'll most likely not work anymore: you'll need to manually port them to Bootstrap in order to make them work again.
If you want to keep both Bootstrap/Tooltip and JQueryUI/Tooltip (assuming that's your scenario), you can use $.widget.bridge to manually change the JQueryUI tooltip plugin name:
// Change JQueryUI/tooltip plugin name to 'uitooltip' to fix name collision with Bootstrap/tooltip
$.widget.bridge('uitooltip', $.ui.tooltip);
You need to to this AFTER importing the JQueryUI js file and BEFORE importing the Bootstrap js file: while you're at it I also suggest you to do the same with button/uibutton to solve the exact same problem. The result code will look like that:
<script type="text/javascript" src="path/to/jqueryui.js" />
<script type="text/javascript">
// Change JQueryUI plugin names to fix name collision with Bootstrap:
$.widget.bridge('uitooltip', $.ui.tooltip);
$.widget.bridge('uibutton', $.ui.button);
</script>
<script type="text/javascript" src="path/to/bootstrap.js" />
Then you can just re-route your $(document).tooltip call to $(document).uitooltip to make everything work.
Alternatively, if you don't find the offending js code and/or you don't want to use $.widget.brige, you can always manually patch bootstrap.js to avoid this kind of error. This can be done by replacing the following line (#1384 in bs 3.3.1):
var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
with this line:
var inDom = $.contains((this.$element[0].ownerDocument || this.$element[0]).documentElement, this.$element[0])
Keep in mind, tho, that you'll still have a broken .tooltip() call in your code somewhere.
See also:
http://www.ryadel.com/2015/01/03/using-jquery-ui-bootstrap-togheter-web-page/ (an article I wrote on my blog to better explain the issue)
https://github.com/twbs/bootstrap/issues/14483
http://jqueryui.com/tooltip/
Check whether the element is null before initialising it
i.e.
if($('[data-toggle="tooltip"]') != null)
{
$('[data-toggle="tooltip"]').tooltip();
}
Using the jquery.datatables plugin with the ColVis addon, I recieve this error when I remove a column:
"Cannot read property 'sWidth' of undefined". I haven't been able to find a solution to this error online.
I'm not sure what's causing the error, although I do have a fix that I would like to post for the benefit of other's who run into this issue.
I'm using jquery.datatables 1.9.4 from http://datatables.net/.
I had this error when the number of columns in
<thead></thead>
was different from the number of columns in
$('#ls-table').DataTable($.extend({}, window.coonDataTableOptions, {
columns: [
<here>
]
}));
On line 3255 of the DataTables source code is this line of code:
nThs[i].style.width = o.aoColumns[iVis].sWidth;
In this case o.aoColumns[iVis] is null because the column represented by the index has just been hidden. It seems like I've run into a corner case that the creators of the plugins weren't expecting. The above code gets called in response to an internal datatables event, which is triggered by a method called by ColVis when a column is hidden. All that's needed to work around this is to change the above code to:
var column = o.aoColumns[iVis];
if(column != null) {
nThs[i].style.width = o.aoColumns[iVis].sWidth;
}
unfortunately this requires editing the core plugin code, but I'll put in a bug report and hope that they resolve this soon. in the meantime, hopefully this helps people looking for a workaround.
Such error occurs just due to populating columns within
...DataTable(...
"columns":...
)
mismatch with the defined HTML page Have number of columns.
..
..
search a.aoColumns[D].sWidth ,replace
var column = a.aoColumns[D];if(column != null) {c.style.width=a.aoColumns[D].sWidth}
I'm using a jQuery plugin called toggleEdit for inline editing.
Everything works fine when the code is actually used in the page.
However, my test suite fails with the following error:
TypeError: Cannot call method 'remove' of undefined
I tracked it down to be triggered from within the clear method of this particular plugin. Its source file can be found here.
There are two relevant bits in that code:
1- The _init function
self.element.addClass("toggleEdit toggleEdit-edit toggleEdit-edit-" +
self._tag(self.element))
//store reference to preview element
.data("toggleEdit-preview", self.p);
As you can see, when the plugin is first instantiated it uses the data structure on self to store the newly created element.
2- The clear function
self.element.data("toggleEdit-preview").remove();
The clear function then tries to access that structure and retrieve the element. That's when, while inside a jasmine spec, it fails with the aforementioned exception.
Has anyone seen anything similar?
EDIT:
This is my spec, it's the simplest piece of code able to reproduce the error:
it("should update the given attribute on the server", function(){
$('#user-details input, #user-details select').toggleEdit(); //this line triggers the error
});
http://alz.so/static/plugins/toggleedit/jquery.toggleedit.js
I was taking a look at the source for toggleEdit and it seems that the only 2 times the function clear is called is just before self.element.data gets set:
if (typeof self.element.data("toggleEdit-preview") !== "undefined") {
self.clear();
self.disableEvents();
}
And at destroy function:
destroy: function() {
var self = this;
self.clear();
self.disableEvents();
$.Widget.prototype.destroy.apply(self, arguments);
}
Since the first call seems to be protected, I ask you a somewhat dumb question: Is it possible that destroy is being called twice?
Found my problem: old version of the jQuery + jQuery UI duo. Upgrading them resolves the exception.