Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    TextMatchStyle and PrimaryKey Fields

    Hi everyone,

    SmartGWT Version: All after 3.1 /Browsers: all

    Since the TextMatchStyle: "Substring" bug was corrected on Jan/2013 there was a few posts where you guys (Isomorphic) mentioned about a flag that could revert to the old style.

    Sample Bug Threads:
    http://forums.smartclient.com/showthread.php?t=25116&highlight=textmatchstyle+flag
    http://forums.smartclient.com/showthread.php?t=24699&highlight=textmatchstyle+flag

    Maybe the EE showcase example "large value map" (http://www.smartclient.com/smartgwtee/showcase/#large_valuemap_sql) was affected by the TextMatchStyle.
    Because, when the table is filtered using a item like "Adding Machine Roll 57x57mm Standard" the result are not exacly the "Adding Machine Roll 57x57mm Standard" itens. (see image)

    I know it's is possible to use a advanced criteria to enforce the "exact" match for the field. (a example is in the threads listed)

    Is there a way to enforce the "exact" TextMatchStyle for a field in the ds.xml file (without using java code)?
    If it can be done in the ds.xml file it would be better than a global flag, since we could use is on a field basis, not global.
    Also, was the flag implemented after all?
    Attached Files

    #2
    Workarond

    For those that stumbled upon the "substring" correction on TextMatchStyle.

    Here is a code that can be used on the IDACall to revert to the old style (compare integer and sequence with "equal" instead of "substring").

    Code:
        @Override
        public DSResponse handleDSRequest(DSRequest dsRequest, RPCManager rpc, RequestContext context) throws Exception {
            AdvancedCriteria ac = dsRequest.getAdvancedCriteria();
    
            ArrayList<String> intFields = new ArrayList<>();
            List<DSField> fieldList = dsRequest.getDataSource().getFields();
            for (Iterator<DSField> it = fieldList.iterator(); it.hasNext();) {
                DSField dSField = it.next();
                String fieldType = dSField.getType();
                if (fieldType.equals("integer")
                        || fieldType.equals("sequence")) {
                    intFields.add(dSField.getName());
                }
            }
    
            if (ac != null) {
                HashMap hMap = new HashMap(ac.getCriteriaAsMap());
    
                ArrayList criteria = (ArrayList) hMap.get("criteria");
                if (criteria != null) {
                    for (Iterator it = criteria.iterator(); it.hasNext();) {
                        HashMap criteriaInside = (HashMap) it.next();
                        String fieldName = (String) criteriaInside.get("fieldName");
                        if ((fieldName != null) && intFields.contains(fieldName)) {
                            ac.getFieldCriterion(fieldName).setOperatorId("equals");
                        }
                    }
                }
            }
            dsRequest.setAdvancedCriteria(ac);
    
            return super.handleDSRequest(dsRequest, rpc, context);
        }
    Anyway...
    1) is there a global flag?
    2) the #large_valuemap_sql sample at the EE showcase is working right?

    Comment

    Working...
    X