dojox.grid.datagrid

How to set css class to a row which has focus in Dojo datagrid


I am using DOJO datagrid version 1.10 What I want is on tab indexing the row in the grid should get highlighted so that user will be able to know on which row the focus is. But I am not getting the row focus.


Solution

  • You could listen on the dojox.grid.DataGrid::onCellFocus event. The event arguments are the focused cell-Object itself and the corresponding rowIndex.

    function onCellFocus(cell, rowIndex) {
    
      // first clear selection
      grid.selection.clear();
    
      // select the focused row
      grid.selection.setSelected(rowIndex, true);
    
      // invoke manually the render method
      grid.render();
    }
    

    I've created a working fiddle for you, which can be found here.