Announcement

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

    ListGrid Filter Text

    Version SmartGWT 2.2
    Browser: FireFox 3.6

    In my test application I am using a combination of the Filter Editor which appears above the Grid Columns and additionally a Filter Builder which uses advanced criteria.

    When using the Filter Builder is there anyway of indicating on the List Grid , the column/columns that have been been filtered by either marking the column header or putting some static text in the Filter Editor Box about the column or change the color of the column .

    Any help would be much appreciated

    Regards,

    Ara

    #2
    It isn't built-in functionality but can be done pretty easily. Just depends on how you want to indicate the filter. Can override getBaseStyle() and hilite the entire column (tracking which columns filtered). You can put text inside the filter editor by using setFilterEditorCriteria(). If you want to change the header that will be hard because it will apply to the whole grid not a specific column.

    Comment


      #3
      Thanks for the reply. I used setFilterEditorCriteria() by passing the advanced criteria with a filter for one column. This sets a text value [Object object]. However when I pass an advanced criteria with a filter for more than one column this results in no text showing the in the filter editor for the filtered columns

      Comment


        #4
        In the end managed to figure it out: Ran the following code prior to setting the setFilterEditorCriteria method

        Criteria ac = new Criteria();
        Map criteriaMap = JSOHelper.convertToMap(criteria.getJsObj());

        // get all the actual criteria as array of JSO objects
        Object[] criteriaObjects=JSOHelper.convertToJavaObjectArray((JavaScriptObject) criteriaMap.get("criteria"));
        for (int i = 0; i < criteriaObjects.length; i++) {
        Map criteriaFieldsMap = JSOHelper.convertToMap((JavaScriptObject) criteriaObjects[i]);
        ac.addCriteria(((String) criteriaFieldsMap.get("fieldName")), "Adv Filter Applied");
        }

        listgrid.setFilterEditorCriteria(ac);

        Comment

        Working...
        X