PDA

View Full Version : [CLOSED] Select Row in Buffered Grid



Patrick_G
Feb 07, 2013, 10:22 AM
Hello

I am using buffered grids and I understand that they do not load all the rows at one time so using something like this does not work:


App.myGrid.getSelectionModel().select(record, false);


On this example page
http://examples2.ext.net/#/GridPanel/Infinite_Scrolling/Buffered_Scrolling/

there is a "GO" feature that allows a user to enter a row number, press Go and the UI is supposed to scroll to that row, however, it does not work. The "go" javascript function fails with the error "verticalScroller.scrollTo" is undefined.

Is there a way to move to a row in a buffered grid given an index? Basically, what would it take to make the go feature on that example page work?

I also tried adding an "ext:GridPagingScroller" to my gird but was not able to make it work.

Thank you for your help.

P

Daniil
Feb 07, 2013, 11:52 AM
Hi Patrick,

Thank you for the report. Strange, there is no such a method in ExtJS 4.1.1 (Ext.NET v2.1 uses it).

Please clarify what Ext.NET sources do you use? If trunk, then use:

grid.getView().bufferedRenderer.scrollTo(100, true);

Patrick_G
Feb 09, 2013, 12:21 AM
Hello Danil

As always, thank you for your quick response, it means a lot to me and my company.

Unfortunately after making sure that we are using the latest 2.1.1.18233 Ext.Net.dll it still does not work. There is no bufferedRenderer of the getView() object. When we do a NuGet we are getting version 2.1.0.0 of the Ext.Net.Utilities.dll. Would the bufferedRender changes have been in the utilities class but maybe they didnt make it into NuGet.

These are all the methods I have tried with no success:


App.myGrid.view.onRowSelect(idx)
App.myGrid.view.onRowFocus(idx, highlight, suppressFocus)
App.myGrid.view.focusRow(idx)
App.myGrid.getView().focusRow(idx)
App.myGrid.getView().container.scrollTo(idx)


I would try these methods, but I am not sure what to pass in for item:


App.myGrid.getView().setHighlightedItem(item)
App.myGrid.getView().highlightItem(item)


These methods come "close" to what we need but we really need to be able to select via an index


App.myGrid.selModel.selectNext(keepExisting, suppressEvent)
App.myGrid.selModel.selectPrevious(keepExisting, suppressEvent)


Is there anyway the buffered renderer example on the example page can be updated to 2.1.1 and javascript function updated to what would allow selection via an index?

Thank you again

Patrick

Baidaly
Feb 09, 2013, 3:46 AM
Hello!

Try the following:



<script>
var go = function () {
var me = this,
field = me.up('toolbar').down('#gotoLine');

if (field.isValid()) {
var v = me.up('grid').verticalScroller;
v.view.el.scrollTo('top', (field.getValue() - 1) * v.rowHeight, false);
}
};
</script>


We are investigating example issue.

Thank you!

Daniil
Feb 09, 2013, 5:50 AM
If trunk, then use:

grid.getView().bufferedRenderer.scrollTo(100, true);

So, a bufferedRenderer is available in the Ext.NET sources from the SVN trunk.

Patrick_G
Feb 09, 2013, 8:42 AM
You guys are too cool!! It worked.

I didnt catch that I should pull the code from your source control, I was looking in the contents of the NuGet package. There is a little more I have to do ... when I build the Ext.Net solution and copy over all the dlls various things dont work. However, when I reference the Ext.Net solution and clean up the references, things work better... I will try to sort this out.

You can close this ticket.

Thank you again for being rock stars!!

Daniil
Feb 09, 2013, 7:00 PM
Thank you for the excellent feedback!:)

Yes, cleaning up a solution helps with such issues.