I'd like to be able to keep two ListGrids showing the same records. That is, scroll on one and the other scrolls. I don't care too much if the control is bi-directional or if one ListGrid controls the other.
What I'm looking for is the API ListGrid.setDrawArea() - I don't think it exists though. I had a peek at the ListGrid.js code to see how frozen rows do this, but no hints there.
This nearly works, but is not efficient. Is there a way to programmatically change the rendered area of the listGrid?
What I'm looking for is the API ListGrid.setDrawArea() - I don't think it exists though. I had a peek at the ListGrid.js code to see how frozen rows do this, but no hints there.
This nearly works, but is not efficient. Is there a way to programmatically change the rendered area of the listGrid?
Code:
final ListGrid listGrid1 = new ListGrid(); final ListGrid listGrid2 = new ListGrid(); listGrid1.setAutoFetchData(true); DataSource dummyData = getData(); generate(dummyData, 1000); listGrid1.setDataSource(dummyData); listGrid2.setDataSource(dummyData); // listGrid2.setSav listGrid1.addDrawAreaChangedHandler(new DrawAreaChangedHandler() { @Override public void onDrawAreaChanged(DrawAreaChangedEvent event) { Integer[] drawArea = listGrid1.getDrawArea(); int start = drawArea[0]; int end = drawArea[1]; listGrid2.setData(listGrid1.getDataAsRecordList().getRange( start, end)); } }); HLayout hLayout = new HLayout(); hLayout.addMember(listGrid1); hLayout.addMember(listGrid2); hLayout.setWidth100(); hLayout.setHeight100(); hLayout.draw();
Comment