ExtJs - getRow by index of Gridpanel - extjs

Im using Extjs 4.1 with a gridpanel. Now I want to get a row by id/index to just hide it (not filter).
I tried that (it says there is no method getRow):
gridpanel.getView().getRow( 0 );
What is the correct way now?
I know gridview has getRow, so why cant I use it?
Edit: there seems to be no such method in 4.

Since ExtJS 4.1.3 no longer returns a GridView you have to work around this.
Take a look at:
Sencha Forum --> Getting gridview row element
In my opinion its a ugly solution, but it's not getting alot of attention..

Related

Sencha touch grid Summaryrow values disappering

I am using Sencha touch grid and I am facing one issue in the development.
The issue is, if I reorder the columns of the grid using ViewOption plugin, the SummaryRow values get disappered. How do I retain the summary row values after Column reordering?
I am using Sencha touch 2.3.x
Thanks in advance!
I was reading the sources and I don't think Grid is finished.
What I found is the ViewOptions.onColumnReorder apparently only change the DOM elements order and not the store order. And reading the SummaryRow.updateGrid I didn't find any bind with both. SummaryRow only bind with store and add/remove/etc columns (not reorder).
I can be wrong, I didnt try grid yet. But I guess your best shot is try to force the SummaryRow.doUpdateSummary after the onColumnReorder.

Extjs4 MultiLevelGrouping Grid and being able to print it

I was trying to print an ExtJs grid and found rahul singla post:
http://www.rahulsingla.com/blog/2010/10/extjs-printing-gridpanels-with-groupingview-and-groupsummary-plugin
which led me to Ed Spencer Printer class, wich led me to Loaine's ExtJs4 version
https://github.com/loiane/extjs4-ux-gridprinter
which is absolutely great, so far so good, but the grid I'm trying to print has a multilevel groupingsummary feature for wich I used this UX
http://www.sencha.com/forum/showthread.php?265814-Multi-level-grouping-summary-and-grand-totals-for-Ext-JS-4.2
Problems are:
1.- While this grid does get printed it doesn't recognize the grouping feature.
2.- The second time the grid with the multilevel groupingsummary feature is rendered or tried to be rendered I get "TypeError: oldGroupCache is null"
I know this stuff is too specific but hopefully somebody else is trying to acomplish the same.
Any help would be appreciated.
(I'm using ExtJs 4.2.1 and can't go to a newer version because of my work)

Ext.net grouping grid

I'm building an application that displays some results in a grid, using the Ext.NET controls.
The grid is created dynamically, in the C# code-behind. I would like to let the user see the results in a grouped grid, grouped on the first column in the grid.
I want to do this dynamically, from C#, by changing the existing grid.
How should I proceed, what properties should I use?
You need to use GroupingStore To dynamically change grouping, you need to use this store's groupBy and clearGrouping methods.
Here is good example from sencha -
Grouping.html (js source code - grouping.js)
Maybe the following Grouping example can help get you started, see
http://examples.ext.net/#/GridPanel/Miscellaneous/Grouping/

How can I get the current row in a grid with a combobox editor

I have an EditorGridPanel with a ComboBox in one of the columns.
Within a 'select' event listener for that ComboBox, I'd like to know which grid row (not ComboBox row) it is on.
The reason is that I'd like to update a different column in the grid every time an item is selected.
I think I'm likely missing something obvious.
Thanks for any help.
As of 4.1, it might be best to use the edit event of the grid instead. You get passed in an event which contains the edited record.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.Panel-event-edit
Ok, for anyone else looking to try this, I found what seems to be an undocumented property of an EditorGridPanel: activeEditor.
This property contains a 'record' property that is a reference to the current record of the ComboBox (or anything really) being edited.
It may be a little frail (since it's undocumented), but seems to work.
In ExtJs 4.2, the property of the grid (for cellediting plugin) to use is:
grid.editingPlugin.getActiveRecord()
The property editingPlugin still seems undocumented, while getActiveRecord() is.
Also in ExtJS 6 you can use undocumented property context which contains record.
grid.editingPlugin.context.record

Scroll to selection in an ExtJS Grid

Hey, i need to be able to scroll my ExtJS grid to the current selection but have no idea how to do this. I came across a reference in a forum to an ensureVisible method but can find no information. Can anyone make any suggestions?
Thanks
This also seems to work:
grid.getView().focusRow(rowIdx);
Unfortunately ensureVisible() was removed from ExtJS 4. The most straight-forward solution I found is to use scrollIntoView(). In my case, this was after selecting the row based on a value I loaded.
var rowIndex = store.find('fieldName', value);
grid.getSelectionModel().select(rowIndex);
Ext.fly(grid.getView().getNode(rowIndex)).scrollIntoView();
This will show the selected row at the bottom of the grid. More work would need to be done to have it at the top or middle of the grid.
This also seems to work:
grid.getView().getRow(rowIdx).scrollIntoView();
Worked for me on ExtJS 6, even with bufferedRenderer turned on.
var record = grid.getSelectionModel().selected.getRange()[0];
grid.getView().focusRow(record);
Sorry, I'm being really dumb. I just tried ensureVisible and it works fine.
This also seems to work
grid.getView().getNode(rowIndex).scrollIntoViewIfNeeded();
In case of ExtJs 4.X No need to use Ext.fly
To save you all a lot of hair pulling, you should know that the solutions in this thread for scrolling into view will not work if grid bufferedRenderer is turned on.
It is my understanding that in Ext JS 5, bufferedRenderer is turned on by default.
It took me a couple hours before I realized this.
grid.getView().getNode(rowIndex) will return NULL if the indexed row is outside the buffered rows.
In 4.2 at least, using scrollIntoViewIfNeeded fails if you're outside of the buffered range in a bufferedRenderer. The bufferedRenderer has a handy scrollTo method to help with this task though:
grid.getView().bufferedRenderer.scrollTo(index, true);
Scrolls to and optionlly selects the specified row index in the total dataset.
http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.grid.plugin.BufferedRenderer-method-scrollTo

Resources