Announcement

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

    Field Picker Filter Editor problem with % character

    Hi there,

    We are seeing an issue with the Filter Editor on the Available Fields grid in the Field Picker.

    Use this example with the code below:
    http://www.smartclient.com/#fieldPicker

    Put the cursor in the Filter Editor above the Available Fields and type % and then to and you should get the first field "% to 100 Day Moving Avg". But, it doesn't show up. I guess you need to add some special handling for certain characters?



    Code:
    function createFields (fieldCount) {
        var fields = [];
        for(var i = 1; i <= fieldCount; i++) {
    
           if(i==1){
    
            //can't search when field has % sign
             var fieldTitle="%*to*100*Day Moving Avg";
            fields.add({name: "field" + i, title:fieldTitle, showIf: "false"});
          }else{
            fields.add({name: "field" + i, title: "Field " + i, showIf: "false"});
    
        }
        }
    
    
        return fields;
    }
    
    function createRecords (recordCount, fields) {
        var records = [];
        for (var i = 0; i < recordCount; i++) {
            var record = {};
            for (var j = 0; j < fields.length; j++) {
                record[fields[j].name] = "Row " + i + ", Value " + (j+1);
            }
            records.add(record);
        }
        return records;
    }
    
    function getOrderedFields(fields) {
        var initialFieldIndices = [ 20, 5, 197, 59, 17, 120, 152, 91, 37, 101, 40, 9, 174, 29, 163 ],
            i, orderedFields = [];
    
        for (i = 0; i < initialFieldIndices.length; i++) {
            var field = fields.find("name", "field" + initialFieldIndices[i]);
            orderedFields.add(field);
            delete field.showIf;
        }
    
        for (i = 0; i < fields.length; i++) {
            var field = fields[i];
            if (field.showIf != null) orderedFields.add(field);
        }
    
        return orderedFields;
    }
    
    var fields = createFields(200);
    
    isc.ListGrid.create({
        ID: "pickableFields",
    
        autoFitData: "both",
        autoFitMaxRecords: 20,
        autoFitMaxColumns: 8,
        autoFitFieldWidths: true,
        canEditTitles: true,
    
        useAdvancedFieldPicker: true,
        fieldPickerFieldProperties: [ "frozen" ],
    
        fields: getOrderedFields(fields),
        data: createRecords(20, fields),
    
        fieldPickerWindowProperties: { isModal: false },
    
        getBaseStyle: function (record, rowNum, colNum) {
            return colNum % 2 == 0 ? "myEvenGridCell" : "myOddGridCell";
        }
    });
    
    pickableFields.delayCall("editFields");

    #2
    You didn't post the version of SC you're using, or your browser or OS details, but we can't reproduce this with your code snippet and the Feature Explorer link you provided. It works as expected.

    Tested FF28+OpenSUSE 13.1
    Tested FF28+Windows 7x64
    Tested Chrome 34 + Windows 7 x64

    Comment


      #3
      Interesting issue. When I copied my text into this forum post, it changed the text to include those * characters. The issue I was trying to solve is that we store our titles with some formatting to control how they display in grid column headers. The solution to my problem in this case was simply the following logic:

      fieldTitle = fieldTitle.replaceAll(String.fromCharCode(160),' ');

      That replaced the non-breaking space in our string with a true space.

      Comment

      Working...
      X