Hi,
I’ve been using a DMI to fetch rows for my ListGrid , using the approach described in the SupplyItemDMI example:
public DSResponse fetch(ProdutoSeguroBean criteria, DSRequest dsRequest) throws Exception {
...
long startRow = dsRequest.getStartRow();
long endRow = dsRequest.getEndRow();
long totalRows = matchingItems.size();
dsResponse.setTotalRows(totalRows);
dsResponse.setStartRow(startRow);
endRow = Math.min(endRow, totalRows);
dsResponse.setEndRow(endRow);
List results = matchingItems.subList((int)dsResponse.getStartRow(),
(int)dsResponse.getEndRow());
dsResponse.setData(results);
return dsResponse;
}
While debuging, I’ve noticed that endRow = -1 (matchingItems is filled correctly), so after Math.min, dsResponse.endRow = -1, leading to the error “fromIndex(0) -> toIndex(-1)”. If I set endRow = totalRows, everything works fine, but I guess I’d lose my ability to paginate through large datasets.
I don’t know if there’s something missing in the ListGrid declaration:
isc.ListGrid.create({
autoDraw:false,
fields: [
{name:"Produtos", value: "nomeProduto", width: 250},
{name:"Versão", value: "versaoProduto", width: 100}
],
dataSource: "produtoSeguro",
autoFetch: false,
emptyMessage: "Nenhum produto cadastrado no sistema.",
ID:"produtosGrid"
})
Any suggestions?
Best,
Leo