Project

General

Profile

How to make issue filter select box to keep the last value

Added by Jan Pazdera about 5 years ago

Hi,

my Redmine plugin is providing some new fields which I have added into the issue filter by "add_available_filter" function. I have also patched the "statement" function to construct the correct SQL for filtering (Filter "Team" on figure 1.png). But when I select my field in the filter, choose the request value from the select box and click Apply button (fiture 2.png), it will display the correct issues, but the value in the select box is reset to the first option (figure 3.png), so I can't see the value of the filter. Can someone help me please, how to keep the option chosen in the select box?

Thanks,
HOP

1.png (25.2 KB) 1.png
2.png (42.9 KB) 2.png
3.png (23.5 KB) 3.png

Replies (1)

RE: How to make issue filter select box to keep the last value - Added by Anonymous almost 3 years ago

you need an array composed only of strings.

So with this command

Object.pluck(:name,:id)

you get this table for example

[["name1",1],["name3",2],["name3",3]]

which is incorrect since you must have

[["name1","1"],["name3","2"],["name3","3"]]

Use this transformation instead

values ||= []
SlaLevel.pluck(:name,:id).map { |name,id|
values << [name.to_s,id.to_s]
}

    (1-1/1)