1

I started to work with ui-grid a few time ago so i'm having some problems. I would like to filter the options in dropdown of every row of the grid. I can filter the values and show it in the dropdown field but when i click in dropdown only appear undefined values. What can i do to solve this problem? I've tried so many things but i can't find the solution.

Here is the plunker

http://embed.plnkr.co/HMsq4OasNs50ywJuI3DS/

Thanks

1
  • Kudos to you for including a plunker. Commented Jun 2, 2016 at 13:48

1 Answer 1

0

I forked your plunker.

In summary, I changed up the column definition to use editDropdownOptionsFunction instead of the combination of editDropdownOptionsArray and cellFilter. According to the documentation,

cellFilter is a filter to apply to the content of each cell

... so that doesn't seem like what you were trying to achieve.

Also, changed the periodos definition for rowEntity.sindicato === 1 to be an array rather than an object.

  editDropdownOptionsFunction: function(rowEntity, colDef) {
    console.log(rowEntity);

    if (rowEntity.sindicato === 1) {
      periodos = [{
        id: 1,
        value: 'teste1'
      }];
    } else if (rowEntity.sindicato === 2) {

      periodos = [{
        id: 2,
        value: 'test2'
      }, {
        id: 5,
        value: 'test5'
      }];
    } else {
      periodos = [{
        id: 3,
        value: 'test3'
      }, {
        id: 6,
        value: 'test6'
      }, {
        id: 4,
        value: 'test4'
      }];

    }

    return periodos;

  }
Sign up to request clarification or add additional context in comments.

2 Comments

Cool. Glad that helped.
Done. Thank for your very simple solution, all things make the sense now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.