The problem is that as the user types in search strings I need a progressive results returned so that partial string matches will sort the local ds. The problem is that treeGrid is blank after each fetch is called until the user types in an exact match to an existing record for the field selected. How can I get partial matches returned from the fetch?
1. SmartClient Version: SNAPSHOT_v8.3d_2012-06-07/Pro Deployment (built 2012-06-07)
2. FireFox 13.0.1
3. Sample Code:
final TreeGrid customerTreeGrid = new TreeGrid();
customerTreeGrid.setDataFetchMode(FetchMode.LOCAL);
customerTreeGrid.setKeepParentsOnFilter(true);
customerTreeGrid.setDataSource(ds);
customerTreeGrid.setWidth(800);
customerTreeGrid.setHeight(250);
customerTreeGrid.setFields(nameField,typeField, expirationDateField, locationDateField, statusField, sortPriority);
TreeGridField nameField = new TreeGridField("NAME", "Customer");
nameField.setWidth("*");
TreeGridField typeField = new TreeGridField("TYPE", "Type", 100);
TreeGridField expirationDateField = new TreeGridField("EXPIRATIONDATE", "Expiration Date", 100);
TreeGridField locationDateField = new TreeGridField("LOCATION", "Location", 130);
TreeGridField statusField = new TreeGridField("STATUS", "Status", 200);
TreeGridField sortPriority = new TreeGridField("SORTPRIORITY", "",0);
final DataSource ds = new DataSource();
ds.setClientOnly(true);
TreeNode[] treeNodes = new TreeNode[customers.size()];
int i = 0;
for(Customer customer : customers){
TreeNode treeNode = new TreeNode();
treeNode.setAttribute("id", customer.getId());
if(null != customer.getParentId())
treeNode.setAttribute("parentId", customer.getParentId());
treeNode.setIsFolder(customer.getIsFolder());
treeNode.setAttribute("PKID",customer.getPkid());
treeNode.setAttribute("NAME", customer.getName());
treeNode.setAttribute("TYPE", customer.getType());
treeNode.setAttribute("EXPIRATIONDATE", customer.getExpirationDate());
treeNode.setAttribute("LOCATION", customer.getLocation());
treeNode.setAttribute("STATUS", customer.getStatus());
treeNodes[i] = treeNode;
ds.addData(treeNode);
i++;
}
treeGrid.fetchData();
Criteria searchCriteria = new Criteria();
searchCriteria.addCriteria("FIELDNAME", "selectedSearchString");
treeGrid.fetch(searchCriteria);
/-------------- ADDING THESE CHANGES MADE NO DIFFERENCE IN BEHAVIOR -----------------/
treegrid.setDataFetchMode(FetchMode.LOCAL);
treegrid.setAutoFetchTextMatchStyle(TextMatchStyle.STARTS_WITH);
treegrid.setAutoFetchData(true);
1. SmartClient Version: SNAPSHOT_v8.3d_2012-06-07/Pro Deployment (built 2012-06-07)
2. FireFox 13.0.1
3. Sample Code:
final TreeGrid customerTreeGrid = new TreeGrid();
customerTreeGrid.setDataFetchMode(FetchMode.LOCAL);
customerTreeGrid.setKeepParentsOnFilter(true);
customerTreeGrid.setDataSource(ds);
customerTreeGrid.setWidth(800);
customerTreeGrid.setHeight(250);
customerTreeGrid.setFields(nameField,typeField, expirationDateField, locationDateField, statusField, sortPriority);
TreeGridField nameField = new TreeGridField("NAME", "Customer");
nameField.setWidth("*");
TreeGridField typeField = new TreeGridField("TYPE", "Type", 100);
TreeGridField expirationDateField = new TreeGridField("EXPIRATIONDATE", "Expiration Date", 100);
TreeGridField locationDateField = new TreeGridField("LOCATION", "Location", 130);
TreeGridField statusField = new TreeGridField("STATUS", "Status", 200);
TreeGridField sortPriority = new TreeGridField("SORTPRIORITY", "",0);
final DataSource ds = new DataSource();
ds.setClientOnly(true);
TreeNode[] treeNodes = new TreeNode[customers.size()];
int i = 0;
for(Customer customer : customers){
TreeNode treeNode = new TreeNode();
treeNode.setAttribute("id", customer.getId());
if(null != customer.getParentId())
treeNode.setAttribute("parentId", customer.getParentId());
treeNode.setIsFolder(customer.getIsFolder());
treeNode.setAttribute("PKID",customer.getPkid());
treeNode.setAttribute("NAME", customer.getName());
treeNode.setAttribute("TYPE", customer.getType());
treeNode.setAttribute("EXPIRATIONDATE", customer.getExpirationDate());
treeNode.setAttribute("LOCATION", customer.getLocation());
treeNode.setAttribute("STATUS", customer.getStatus());
treeNodes[i] = treeNode;
ds.addData(treeNode);
i++;
}
treeGrid.fetchData();
Criteria searchCriteria = new Criteria();
searchCriteria.addCriteria("FIELDNAME", "selectedSearchString");
treeGrid.fetch(searchCriteria);
/-------------- ADDING THESE CHANGES MADE NO DIFFERENCE IN BEHAVIOR -----------------/
treegrid.setDataFetchMode(FetchMode.LOCAL);
treegrid.setAutoFetchTextMatchStyle(TextMatchStyle.STARTS_WITH);
treegrid.setAutoFetchData(true);
Comment