Search code examples
smartgwt

Select a record based on attributes


I want to select a record in the listgrid based on a criteria i provide. How do I do this?

My criteria is:

Criteria criteria= new Criteria();
filterCriteria.addCriteria("id", idToSelect);

Solution

  • If you filter, other records in the grid will be removed. You can try the following to select only the desired record:

    int index = myGrid.getDataAsRecordList().findIndex("attribute", "myValue");
    myGrid.selectSingleRecord(index);
    myGrid.scrollToRow(index);