0

Using the datatable, within the Grails UI plugin, does anyone know how to make the list of dropdownOptions dynamic?

You can specify the dropdownOptions like this:

[age:'Age', formatter:'number', editor:[type:'dropDown', controller:'demo', action:'tableChange', config:[dropdownOptions: ['Foo', 'Bar'], disableBtns:true]], sortable:true, resizeable: true],

I was hoping it would work in the following way:

[age:'Age', formatter:'number', editor:[type:'dropDown', controller:'demo', action:'tableChange', config:[dropdownOptions: Foo.list(), disableBtns:true]], sortable:true, resizeable: true],

ncl
  • 31
  • 3

1 Answers1

0

I don't think this is built directly into GrailsUI plugin but what you can do is add a formatter to the cell and build the drow-down from there. Something like this..

<script>
var customFormatter = function(elCell, oRecord, oColumn, oData) {
  elCell.innerHTML = 
    <g:select id="..."
    </g:select>
 }
}
</script>
<gui:dataTable id="myTable" ....
  columnDefs="[
        [key:'key', label:'Label', formatter:'@customFormatter']
]"/>

From there you are simply using the

Patrick
  • 13
  • 3