Re: scroll to a specific row in a standard views using command?

Hi

I think the way to do what you want is to use the showDataLocation method of the LocationDisplayer of the ODM Application.

 public void showPlanDetails() {
    int sel = _table.getSelectedRow();
    if (sel == -1) {
      return;
    }
    String product = (String) _tableModel.getValueAt(sel, 0);
    IloOrderedTable table = (IloOrderedTable) getODMApplication().getCurrentScenario().getTable(
        _planTableId);
    List rows = table.getOrderedRows();
    for (int i = 0, c = rows.size(); i < c; i++) {
      if ((rows.get(i)).getStringValue("PRODUCT").equals(product)) {
        IloDataLocation location = new IloDataLocation(_planTableId, -1, i);
        
getODMApplication().getLocationDisplayer().showDataLocation(location);
        return;
      }
    }
    // Not found (Should not happen)
    Toolkit.getDefaultToolkit().beep();
  }

There is an example showing this in the distribution in:

ODME39/Developer/examples/Advanced/CustomView/step5/customView5_java/src/customView/step5/

 

This is what is used internally by DOC to link data errors with visualization in views…

Regards

Michel

 

Source: Re: scroll to a specific row in a standard views using command?