【问题标题】:Grails UI datatable dynamic dropdownOptionsGrails UI 数据表动态下拉选项
【发布时间】:2010-04-30 03:31:04
【问题描述】:

使用 Grails UI 插件中的数据表,有人知道如何使 dropdownOptions 列表动态化吗?

您可以像这样指定 dropdownOptions:

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

我希望它可以通过以下方式工作:

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

【问题讨论】:

    标签: grails grails-plugin yui-datatable


    【解决方案1】:

    我不认为这是直接内置到 GrailsUI 插件中的,但您可以做的是向单元格添加格式化程序并从那里构建下拉菜单。像这样的..

    <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']
    ]"/>
    

    从那里您只需使用

    【讨论】:

      猜你喜欢
      • 2012-04-30
      • 2021-03-11
      • 1970-01-01
      • 2017-03-08
      • 1970-01-01
      • 2016-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多