jsf - dynamic dataTable and sortBy not working -
jsf - dynamic dataTable and sortBy not working -
i'm using primefaces , datatable (lazy mode) , need generate definition of datatables on fly / in code. i'm able build datatable, columns, labels, values, ... sorting not working.
i tried:
column.setsortby("name"); // name name of property/column column.setsortby("#{row['name']}"); // row map , name name of property/column - im using in xml version , working column.setsortby(ef.createvalueexpression(context, "#{row['name']}", object.class));
datatable looks disabled sorting (no arrows @ labels)...
when have definition in xml works fine (it's not lazydatamodel or else in model layer).
try code
facescontext context = facescontext.getcurrentinstance(); expressionfactory expressionfactory = context.getapplication().getexpressionfactory(); valueexpression valueexpression = expressionfactory.createvalueexpression(context.getelcontext(), "#{row['name']}", string.class); column.setvalueexpression("sortby", valueexpression);
where used string.class
because supposed "#{row['name']}" evaluates instance of class string
.
jsf primefaces
Comments
Post a Comment