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.
Related
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 :)
First of all, I am using 6.2 version of extjs framework.
I'm facing a problem to save new records using the ext.js grid with the "Ext.grid.plugin.RowEditing" plugin.
When I try to save a record, since the line does not have a combobox in the editor, it works fine.
However, when I add a combobox in the the line editor, the following error occurs:
Can not read property 'mergeAttributes' of null
By checking the extjs framework code, I noticed that the error occurs when the editor is exiting and the line is being populated with the modified content.
This occurs in following section of the Table.js file:
cellSelector = me.getCellSelector(column);
oldCell = oldRow.selectNode(cellSelector);
newCell = newRow.selectNode(cellSelector);
// Copy new cell attributes across. Use IE-specific method if possible.
if (oldCell.mergeAttributes) {
oldCell.mergeAttributes(newCell, true);
} else {
newAttrs = newCell.attributes;
attLen = newAttrs.length;
for (attrIndex = 0; attrIndex < attLen; attrIndex++) {
attName = newAttrs[attrIndex].name;
if (attName !== 'id') {
oldCell.setAttribute(attName, newAttrs[attrIndex].value);
}
}
}
Basically, the variable "oldCell" is not being populated by "oldRow.selectNode (cellSelector)".
In the first column I put an invisible column containing the Id of the record. This cell is being filled, however, any other cell, having the combobox or not, is returning "oldCell" as null.
Just to enforce, when I remove all comboboxes from editor it works.
This is also true only with new records.
Luckily the bug is easy to fix.
I have a "render" in the column where the combobox is placed.
An unhandled error was occurring in this render. So, I corrected it and the bug disappeared.
#André Cristino: I believe it's renderer in the column rather than render.
Basically, both are different.
Render term is used while creating a component.
A renderer is a kind of template used to change the data in a grid cell.
Though I don't have any error in the renderer, I am still facing the mergeAttributes issue.
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
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 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