Wednesday, 15 September 2010

html - Can rails grouped_collection_select 'options' be styled? -


I am using Bootstrap and Ruby on Twitter for back-end.

I searched a lot but he could not find any answer.

In my web app, I need to implement the dependent dropdown (like country and state). For this, I have used " grouped_collection_select ", however, options are generated dynamically and I need to styling options like direct image, divider image, etc. I should know that is it possible? Or is there any remedy?

Thanks in advance!

Yes it can!

  & lt; Div class = "field" & gt; & Lt;% = f.label 'blah'% & gt; & Lt;% = f.grouped_collection_select: category_id Category: roots.order (: name) ,: children, name ,: id ,: name, {include_blank: true}, {class: "form-control"}% & gt; ; & Lt; / Div & gt;  

Should be included in the braces - otherwise it will not work. Apart from this, if you change class = field from class = form control, this will not work. And there are more than a billion other scenarios when it will not work, but I have tried only for them :)

'njoy!


No comments:

Post a Comment