How to set Focus on Grid Cell?
New DiscussionI have a grid which is two banded, InvestmentCategory has one or more InvestmentGroups. I enter InvestmentGroups under one InvestmentCategory. I want to detect the Duplicate investmentGroup under one investmentCategory and if duplicate is detected, I want to setfocus on that cell. I have written JavaScript in AfterCellUpdateHandler, clientside event handler. But this is not working. Duplicate detection works fine but setFocus does not work. SelectionType of Column is defined as single.
Here is how the code looks like,
function investmentCategoryUltraWebGrid_AfterCellUpdateHandler(gridName, cellId){
//Add code to handle your event here.
var col=igtbl_getColumnById(cellId);
if(col.Key!=‘description’)
return;var cell=igtbl_getCellById(cellId);
var Data=cell.getValue();
var row=cell.Row;
var index=row.getIndex();
//Finding Parent Row.
var parentRow=row.ParentRow;
//Now Finding Child RowCount of this Parent
var childRowCount=parentRow.ChildRowsCount;
for(var i=0;i<=childRowCount;i++)
{
if(index!=i) //Skip the one selected
{
var processingRow= parentRow.getChildRow(i);
var processingCellObj=processingRow.getCell(1);
var processingCellValue=processingCellObj.getValue();if(processingCellValue==Data)
{
alert(‘Duplicate detected, Please check your data’);
cell.setSelected(); //THIS PART OF THE CODE DOES NOT WORK,
cell.activate();
break;
}
}
}
}
Thank you very much for your help.