0
我正在使用primefaces和dataTable(懒惰模式),我需要在代码中飞/产生dataTables的定义。我能够构建dataTable,列,标签,值,但排序不工作。动态数据表和sortBy不工作
我想:
column.setSortBy("name"); // where name is name of property/column
column.setSortBy("#{row['name']}"); // where row is map and name is name of property/column - this is what im using in XML version and it working very well
column.setSortBy(ef.createValueExpression(context, "#{row['name']}", Object.class));
数据表看起来像有残疾排序(按标签没有箭头)...
当我在XML定义,然后一切工作正常(它不是lazyDataModel或任何其他模型层)。
setValueExpression是解决方案!谢谢!最终的工作版本是'column.setValueExpression(“sortBy”,ef.createValueExpression(context,“#{name}”,Object.class));'(表达式必须改成这个,不知道为什么,但它的工作原理) – user3332640 2014-11-06 16:14:44