Hi,

I am trying to set the focus on a particular row in the grid, but it does not seem to work on a GridPanel, grid was rendered using data from Ajax call, ajax call get data in JSON format.

Here;s the code i am using, can anybody help me on this, i love extjs

function buildextmorttable(resptext,contentdiv) {

var jsonResp = Ext.util.JSON.decode(resptext);

var store= new Ext.data.JsonStore({
root:'mortgagePrice'
,fields:[
{name:'noteRate', type:'string'}
,{name:'points', type:'string'}
,{name:'price', type:'string'}
]
,data:jsonResp
});

var cm = new Ext.grid.ColumnModel([
{header: "Note Rate", width: 60, dataIndex: 'noteRate', sortable: true},
{header: "Points", width: 60, dataIndex: 'points', sortable: true},
{header: "Price", width: 60, dataIndex: 'price', sortable: true}
]);


// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns:[
{header: "", width: 30, dataIndex: 'noteRate', sortable: false,renderer: showradio},
{header: "Note Rate", width: 60, dataIndex: 'noteRate', sortable: true},
{header: "Points", width: 60, dataIndex: 'points', sortable: true},
{header: "Price", width: 60, dataIndex: 'price', sortable: true,align:'center'}
],
renderTo:contentdiv,
collapsible:true,
collapsed:false,
stripeRows: true,
width:230,
height:190,
title:'Mortgage Pricing'
});



grid.getSelectionModel().selectLastRow(); //does not work

grid.getView().focusRow(7); // does not work

grid.getView().focusEl.focus(); //does not work

var rec = grid.getSelectionModel().getSelected(); //does not work
}


function doJSON(responsetext,processingdiv,contentdiv) {
try {
document.getElementById(processingdiv).style.display = "none";
document.getElementById(contentdiv).style.display = "block";
document.getElementById(contentdiv).innerHTML = "";
buildextmorttable(responsetext,contentdiv);
} catch (err) {
Ext.MessageBox.alert('ERROR', 'Could not decode ' + responsetext);
}
}

function doJSONWithExt(processingdiv,contentdiv)
{
//params : { action : 'getDate'}
var paramstr = '{ action : ' + '"getDate"' + '}';
document.getElementById(processingdiv).style.display = "block";
document.getElementById(contentdiv).style.display = "none";
Ext.Ajax.request({
url : '/ilc/JSONServlet',
params : paramstr,
method : 'POST',
success: function (result, request) {
doJSON(result.responseText,processingdiv,contentdiv);
},
failure:function ( result, request) {
Ext.MessageBox.alert('Failed', 'Successfully posted form: '+result.date);
}
});
}