View Full Version : selectFirstRow() failing - NOT the FAQ

6 Oct 2011, 4:11 AM
I created a quick "proof of concept" application using the demo designer. It populates a grid from JSON that comes from a dynamic web page generated by another app. Everything seems to work great EXCEPT for the selectFirstRow() method that I'm trying to call last. The error is "object doesn't support property or method 'selectFirstRow' " . I've dug through hours of forum entries, FAQ, and docs with no luck. The code from the generated .js file edited in order to add the event handlers is below.
Ext.define('OrionSales.view.vpOrionSales', {
extend: 'OrionSales.view.ui.vpOrionSales',
initComponent: function() {
var me = this;
this.onbtnCustNameClick, this);
this.onGridRowSelect, this);
// theGrid.getStore().on('load', this.onStoreLoad, this);
onbtnCustNameClick: function() {
var cs = Ext.StoreMgr.get("CustStore");
var myProxy = cs.getProxy();
var strSearch = Ext.getCmp("txtSearchName").getValue();
myProxy.url = "/scripts/codexdv1.wsc/JSONFindCustomer.p?Mode=CustBegins&FilterValue=" + strSearch;
var sm = this.down('#custGrid').getSelectionModel();
onGridRowSelect: function(grid, record) {

I also tried it in the "onStoreLoad" event for fun, but I ended up with the same error.


6 Oct 2011, 4:44 AM
Is this 3.x? This is a 4.x section. In 4.x the selection models don't have a selectFirstRow() method.

6 Oct 2011, 4:56 AM
Well, that is annoying that it is not a feature in 4.x considering the zillion examples I poured through. To actually answer the question myself (at least what I am guessing is the answer), I moved the attempt to the onStoreLoad and used sm.Select(0) to select the first record. It appears to work, but I'd have been more comfortable if I read it from a sanctioned example than using guesswork and the Sencha Docs minimal reference page.