Announcement

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

    Unable to define advanced hilite rule on canFilter=false field

    Hi,
    If a field is marked as canFilter=false then it is not possible to create an advanced hilite rule on it.
    To reproduce go to showcase example http://www.smartclient.com/#dataDrivenHilites and change countryDSHilites as follows:
    Code:
    isc.DataSource.create({
        ID: "countryDSHilites",
        fields:[
            { name: "countryName", title:"Country" },
            { name: "countryCode", title:"Code" },
            { name: "independence", title:"Independence", type:"date" },
            { name: "population", title:"Population", type:"integer", canFilter: false },
            { name: "gdp", title:"GDP ($M)", type:"float" },
            { name: "area", title:"Area (km²)", type: "float" },
            { name: "population", type: "integer", title: "Population" },
            { name: "capital", type: "text", title: "Capital" },
            { name: "government", type: "text", title: "Government", length: 500 }
        ],
        clientOnly: true,
        testData: countryDataHilites
    });
    population field is marked as not search able.

    Also change dataDrivenHilites.js as follows:
    Code:
    var ds = isc.DataSource.get("countryDSHilites");
    
    isc.VLayout.create({
        ID:"layout",
        width:500, height:250
    });
    
    
    // Function to create a new ListGrid.
    function recreateListGrid() {
        layout.addMember(isc.ListGrid.create({
            ID: "countryList",
            width:"100%", height:"*",
            alternateRecordStyles:true,
            dataSource: ds,
            autoFetchData: true,
            canAddFormulaFields: true,
            canAddSummaryFields: true,
                showFilterEditor: true,
                canEditHilites: true,
            fields:[
                {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/",
                    imageURLSuffix:".png"
                },
                {name:"countryName", title:"Country"},
                {name:"capital", title:"Capital"},
                {name:"population", title:"Population", format:",0"},
                {name:"area", title:"Area (km²)", format:",0"},
                {name:"gdp", format:",0"}
            ],
            hilites:     [
                {
                    fieldName: "area",
                    textColor: "#FF0000",
                    cssText: "color:#FF0000;",
                    id: 0
                },
                {
                    fieldName:[
                        "area"
                        ,
                        "gdp"
                    ],
                    textColor: "#FFFFFF",
                    backgroundColor: "#639966",
                    cssText: "color:#3333FF;background-color:#639966;",
                    id:1
                }
            ]
        }));
    
    }
    
    // Create the initial ListGrid.
    recreateListGrid();
    Added:
    showFilterEditor: true,
    canEditHilites: true,

    Try it now and define hilite rule on population field:
    Click image for larger version

Name:	simple hilite rule.png
Views:	106
Size:	30.4 KB
ID:	242772


    This is working perfectly:
    Click image for larger version

Name:	simple hilite rule working.png
Views:	88
Size:	61.8 KB
ID:	242773

    But if you try to add an advanced rule:
    Click image for larger version

Name:	advanced hilite rule.png
Views:	88
Size:	59.2 KB
ID:	242774

    then you are not able to enter any value into the criteria.

    It seems to me that hilite advanced rule is using common criteria editor which is not aware of the fact that it is fine to enter criteria for non searchable field while defining hilite rule.
    Thanks
    MichalG

    #2
    canFilter:false means that the grid should not show UI for searching on a field, and that's inclusive of both the FilterEditor and any other dialogs launched by the grid, such as the HiliteEditor.

    By defining hilites that involve a field where end user filtering is not supposed to be allowed, and yet allowing editing of hilites, you've provided inconsistent instructions to the grid and the results are not specified.

    If you just wanted to make the FilterEditor not allow search, you could set the listGridField.filterEditorType to StaticTextItem.

    If you want this particular hilite to not be editable, you can set hilite.canEdit to false.

    Comment


      #3
      Originally posted by Isomorphic View Post
      By defining hilites that involve a field where end user filtering is not supposed to be allowed, and yet allowing editing of hilites, you've provided inconsistent instructions to the grid and the results are not specified.
      Well, requirement to disable hilite editor as a whole just because datasource has one field marked as not filterable seems too hard for my end users.

      There is inconsistency, but in the 2 ways hilite rule can be defined: you can do this for such a field through simple editor, but can't do the same through advanced editor.
      But, if you would like to remove those inconsistency by protecting simple hilite editor from defining rules on unsearchable fields, then better do nothing :-)

      Thanks
      MichalG



      Comment


        #4
        We did not say you should disable the hilite editor. If you are going to define a hilite that includes a non-filterable field, then that hilite must be marked canEdit:false, because if one field from the hilite is not filterable, then there is no way to show an editor for that hilite.

        Comment

        Working...
        X