-
28 Nov 2006 5:40 AM #1
In Grids, does not work function "focusRow" :(
In Grids, does not work function "focusRow" :(
This my code:
I have made function "Scroll" with parameter idRow and I wish it to cause after filling grids. But function don't work. How it correctly to make? And second question: How to find out number of the necessary line on entrance parameters from a server?Code:var XmlExample = { init : function(){ var schema = { tagName: 'item', id: 'uid', fields: ['id', 'name', 'producer'] }; this.dataModel = new YAHOO.ext.grid.XMLDataModel(schema); this.dataModel.onLoad.subscribe(this.onLoad.createDelegate(this)); var myColumns = [ {header: "ID", width: 21, sortable: true}, {header: "Name;", width: 21, sortable: true}, {header: "Prod", width: 20, sortable: true} ]; var colModel = new YAHOO.ext.grid.DefaultColumnModel(myColumns); var sm = new YAHOO.ext.grid.SingleSelectionModel(); this.grid = new YAHOO.ext.grid.Grid('xml-grid-example', this.dataModel, colModel, sm); this.grid.addListener('rowdblclick', this.dblclick); this.grid.render(); }, dblclick : function(grid, rowIndex){ var id = grid.getDataModel().getRowId(rowIndex); grid.getView().focusRow(20); }, onLoad : function(){ }, scroll : function(idRow){ grid.getView().focusRow(20); // don't worked }, search : function(mid, wfilter){ getEl('load-ind').show(); var params = {'mid': mid, 'wfilter': wfilter}; this.dataModel.load('/catalog/getlist.php', params, this.clearIndicator); }, clearIndicator : function(file){ getEl('load-ind').hide(); } } YAHOO.util.Event.on(window, 'load', XmlExample.init, XmlExample, true);
Thanks for the answers.
-
28 Nov 2006 5:47 AM #2
Have you tried grid.scrollTo(20)? That is the preferred way to scroll to a row and doesn't use focus.
You may end up with conflicting operations though because when a row is selected it is focused. You are trying to focus a different row at the same time. I'm not sure what the results would be.
-
28 Nov 2006 6:03 AM #3
Yes, I tried grid.scrollTo() - this work, but I need allocation of a line instead of is row scrolling to it. It is necessary for search.
-
28 Nov 2006 6:10 AM #4
What do you mean allocation of line? Selecting the row? That's is done through the grid's selection model.
-
28 Nov 2006 6:46 AM #5
-
28 Nov 2006 8:10 AM #6
It's right there in the documentation at http://www.yui-ext.com/deploy/yui-ext/docs/
You need to get the SelectionModel from your grid, and ask that to do it.
-
29 Nov 2006 6:39 AM #7
Many thanks. Excuse, has badly read through the instruction.
Originally Posted by Animal

Similar Threads
-
Where are animate classes: "Actor" , "Animato
By Young in forum Ext 2.x: Help & DiscussionReplies: 13Last Post: 25 Jul 2007, 4:00 AM -
"FireFox2 kills cursor" and text-select in toolbar
By brian in forum Ext 1.x: BugsReplies: 8Last Post: 7 Jun 2007, 12:12 AM -
Firebug and enctype="multipart/form-data"
By Domitian in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 21 Feb 2007, 2:56 PM -
"alert()" interrupts function
By nora in forum Ext 1.x: Help & DiscussionReplies: 4Last Post: 22 Dec 2006, 10:52 AM -
GridView focusRow() does not work if column 0 is hidden
By jarrod in forum Ext 1.x: BugsReplies: 2Last Post: 20 Dec 2006, 6:48 PM


Reply With Quote