DataTable SearchPanes breaks when executing rebuild() - javascript

I am using SearchPanes and it nearly works all perfect - My DataTable fields can dynamically change and therefore I also need to rebuild the SearchPanes data since it can show information which is no longer on the table.
From DataTable SearchPane documentation I am aware that they have 2 functions to achieve this:
executing datatable().searchPanes.rebuild()
executing datatable().searchPanes.rebuildPane(paneIndex)
When I execute the 1st option I get the following:
jquery.dataTables.min.js:360 Uncaught RangeError: Maximum call stack size exceeded
at new v (jquery.dataTables.min.js:360)
at v.iterator (jquery.dataTables.min.js:369)
at v.<anonymous> (dataTables.searchPanes.min.js:101)
at Function.rebuild (jquery.dataTables.min.js:377)
at v.<anonymous> (dataTables.searchPanes.min.js:101)
at v.iterator (jquery.dataTables.min.js:369)
at v.<anonymous> (dataTables.searchPanes.min.js:101)
at Function.rebuild (jquery.dataTables.min.js:377)
at v.<anonymous> (dataTables.searchPanes.min.js:101)
at v.iterator (jquery.dataTables.min.js:369)
Besides, when I execute the 2nd option I do not get any exception but all the searchPanes get completely blocked and I cannot use them to filter anything at all.
I am currently using SearchPanes version 1.2.1
Should I be doing this in order to achieve what I want to do? What am I making wrong?
Thanks in advance :)

Related

Issue with JS callback when selecting a bokeh datatable row

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', ...)

Scroll a row into view programmatically in buffered grid

I have a buffered, grouped grid and I want to scroll into view a certain row (I have both the record and the record's/row's index at hand).
I have tried the undocumented
grid.getView().scrollRowIntoView(index)
but this only works in unbuffered grids, because it calls
view.getRow(row)
which only returns rows that are currently rendered, not the ones that are not rendered.
Is there an official function available I overlooked or what else can I do to scroll to the correct record?
bufferedRenderer plugin has a function scrollTo(recordIdx).
There is no function in gridpanel or gridview or dataview that calls bufferedRenderer.scrollTo, so I guess you have to call getView().bufferedRenderer.scrollTo directly from your grid.
Update: Please note that scrollTo may not be called if the store is empty, as this causes an error in the framework. Reason is that scrollTo takes the record index; if the index is below 0, it will be set to 0, if it is store.Count() or greater, it will be set to store.Count()-1 (which is -1 if the store is empty). Then, the record is fetched from the store (getAt(index)), which returns null if and only if the store is empty, and then it is checked that the record is indeed a model:
if(record.isModel)
which then causes the error
Uncaught TypeError: Cannot read property 'isModel' of null
So you have to always check that the store is not empty before calling scrollTo:
if(view.store.getCount()) view.bufferedRenderer.scrollTo(index);
The question has been crossposted in Sencha forum, where Gary Schlosberg of the Sencha Support team answered:
Have you tried the ensureVisible config? The callback option mentions usage with a BufferedStore.

Javascript error when moving recurring appointments

Using the RadSchedular, a RadWindow appears when moving an appointment in a series of recurring appointments asking me if I want to move them al or just the current appointment.
No matter what I choose an error is thrown telling me that object 'this' does not contain a method called 'get_owner'.
The Telerik.Web.UI dll's are on version 2014.2.724.40 and the project is an ASP.NET project.
The error occurs in a dynamic blank script and looks like this:
_onAppointmentMoveCallback:function(j,h){h.Scheduler._raiseRecurrenceActionDialogClosedEvent(h,false,b.RecurrenceAction.Move);
var k={appointment:h.Appointment,newStartTime:h.NewStart,editingRecurringSeries:j,targetSlot:h.TargetSlot,isAbortedByUser:false};
var i=a.raiseCancellableControlEvent(h.Scheduler,"appointmentMoveEnd",k);
//Error in next if()
if((this.get_owner().get_groupBy()!==g)&&this.get_owner()._webServiceSettings.get_isEmpty()&&h.Appointment.get_resources().indexOf(h.SourceSlot.get_resource())==-1){i=true;
}if(!i){h.Scheduler.moveAppointment(h.Appointment,j,h.SourceSlot,h.TargetSlot);
}else{h.Appointment._abortDrag();
}}
If I understand correctly, this is Telerik's internal code and I can't do anything about it? Is there anyone who encountered the same problem?
These two images reflect on the debugger state:

Error with JQuery DataTables and ColVis plugin "Cannot read property 'sWidth' of undefined"

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}

gridcomplete function always running?

I'm using jqgrid with grails and need to select some objects. This works for one given object. My problem is that sometimes, calling function has no id. So there is nothing to do after grid completion. And I'm not able to do that even after trying if (false)... In all case, grid.jqgrid("setSelection... is executed and I get the message
java.lang.NullPointerException
Cannot get property 'id' on null object
which is true. But why is this line executed ???
gridComplete: function() {
if (false) {
grid.jqGrid("setSelection",'${cableFocus.id}',true);
}
return;
I have a second question : How can I use gridComplete to select several rows instead of one ?
Thanks very much for any help,
Olivier
The problem is not with gridComplete or your if statement (which is javascript). As you are getting a java error i'm guessing ${cableFocus.id} is placeholder (which will always get exectuted)
So the javascript is not running but your java code is still attempting to run and throwing the error

Categories

Resources