Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No filter row shown at all #11

Open
Gargaroz opened this issue Feb 24, 2017 · 0 comments
Open

No filter row shown at all #11

Gargaroz opened this issue Feb 24, 2017 · 0 comments

Comments

@Gargaroz
Copy link

Gargaroz commented Feb 24, 2017

Dear @tybeck,
I really like what you got here, but it looks like I can't make it work as expected.
I wrote the directive down inside the controller template like this:

<paasb-search-box
       search-params="searchctrl.sOptions"
      paasb-search-box-filtering="searchctrl.sFilters"
      paasb-search-box-enable-filtering-operators="true"
      paasb-search-box-config="searchctrl.sConfig"
      paasb-search-box-auto-complete="searchctrl.sConfig"
      paasb-search-box-cache-filter="true"
      paasb-search-box-filter-selectors="searchctrl.sFilterSelectors"
      paasb-search-box-filter-operators="searchctrl.sFilterOperators"
      paasb-search-box-enable-grouping="true">
    </paasb-search-box>

and inside the controller I basically pasted pretty much everything about the example:

var vm = this;

vm.sOptions = {};

vm.sFilters = [
          {
            'name': 'folder',
            'displayName': 'folder',
            'root': 'Column',
            'suggestedValues': [
                    'Test folder',
                    'asd',
                    'asd1',
                    'asd2'
                ],
            'restrictedSuggestedValues': true,
            'multi': true
            //, 'notFiltered': true
          }, {
            'name': 'name',
            'displayName': 'Name',
            'root': 'Column'
          }, {
            'name': 'desc',
            'displayName': 'Desc',
            'root': 'Column'
          }, {
            'name': 'output',
            'displayName': 'Output',
            'suggestedValues': [
                  '(*.xls)',
                  '(*.mdb)',
                  '(*.txt)',
                  '(*.xml)'
                ],
            'restrictedSuggestedValues': true,
            'root': 'Column'
          }, {
            'name': 'model',
            'displayName': 'Model',
            'suggestedValues': [
                  'yes',
                  'no'
                ],
            'restrictedSuggestedValues': true,
            'root': 'Column'
          }, {
            'name': 'pubblic',
            'displayName': 'Pubblic',
            'suggestedValues': [
                  'yes',
                  'no'
                ],
            'restrictedSuggestedValues': true,
            'root': 'Column'
          }, {
            'name': 'editing',
            'displayName': 'Editing',
            'suggestedValues': [
                  'yes',
                  'no'
                ],
            'restrictedSuggestedValues': true,
            'root': 'Column'
          }, {
            'name': 'type',
            'displayName': 'Type',
            'suggestedValues': [
                  'C',
                  'R',
                  'T',
                  'U',
                  'C'
                ],
            'restrictedSuggestedValues': true,
            'root': 'Column'
          }
      ];

      $scope.$on('onRegisterApi', function (ev, api) {

          console.log('api', api);
        
          var change = function (ev, params) {

          console.log(ev, params, 'params');

        };
          api
          .on('onChange', change)
          .on('onQueryAdded', function (ev, query) {
          
             console.log(ev, 'query:', query);
          
           })
           .on('onEnteredEditMode', function (ev, filter) {
          
             console.log(ev, 'edit', filter);
          
           })
           .on('onLeavedEditMode', function (ev, filter) {
          
             console.log(ev, 'leave', filter);
          
           });
        
         api.on('onQueryRemoved', function (ev, query) {
        
           console.log(ev, 'removed query:', query);
        
         });
        
         api.on('onQueryChanged', function (ev, query) {
        
           console.log(ev, 'changed query:', query);
        
         });
        
         api.on('onEraser', function (ev) {
        
           console.log(ev, 'erased');
        
         });
        
         api.on('onGarbage', function (ev) {
        
           console.log(ev, 'garbage');
        
         });
        
         api.on('onFilterAdded', function (ev, filter) {
        
           console.log(ev, 'added filter', filter);
        
         });
        
         api.on('onFilterRemoved', function (ev, filter) {
        
           console.log(ev, 'removed filter', filter);
        
         });
        
         api.on('onFilterChanged', function (ev, filter) {
        
           console.log(ev, 'changed filter', filter);
        
         });
        
         api.on('onOperatorChanged', function (ev, op) {
        
           console.log(ev, 'changed operator', op);
        
         });
        
         api.on('onFilterSelectorChanged', function (ev, sel) {
        
           console.log(ev, 'changed selector', sel);
        
         });

         api.off('onchange');
      });

      vm.sConfig = {
        'delay': 1000, /* How long before paasb fires off a change event */
        'showMagnifierAlways': false, /* Should we keep magnifier or remove it when there is some sort of query/filter? */
        'placeholders': ['Click here to start a visual search']
      };

      vm.sFilterOperators = [
        {
          "name": "NOT"
        },
        {
          "name": "AND",
          "selected": true
        }, {
          "name": "OR"
        }
      ];

      vm.sFilterSelectors = [
        {
          "name": "Contains",
          "key": "contains",
          "selected": true,
          "notAllowed": [
            "restrictedSuggestedValues"
          ]
        },
        {
          "name": "Does not contain",
          "key": "doesNotContain",
          "notAllowed": [
            "restrictedSuggestedValues"
          ]
        },
        {
          "name": "Is Equal To",
          "key": "isEqualTo"
        },
        {
          "name": "Is Not Equal To",
          "key": "isNotEqualTo"
        },
        {
          "name": "Starts with",
          "key": "startsWith"
        },
        {
          "name": "Ends with",
          "key": "endsWith"
        },
        {
          "name": "Similiarity",
          "key": "similiarity"
        }
      ];

But when I click the filter button no row is shown, and taking a look at the console I saw no error thrown; taking a look to the HTML elements, I found inside the ng-repeat in charge to render the possible filters no one of its rows satisfies the ng-if="filter.notFiltered" condition, thus they are all out of the DOM.
Finally, inspecting the filters array, this property is missing in every filter object.

Please help me find what am I doing wrong.
Thank you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant