-
1. Re: How to catch sorting event on Extended Data Table
ilya_shaikovsky Dec 15, 2009 10:19 AM (in response to kubap.) -
2. Re: How to catch sorting event on Extended Data Table
kubap. Dec 15, 2009 3:18 PM (in response to ilya_shaikovsky)Hi,
Thansk for the fast answer. Is this posible to catch sorting event using any action listener ? I could send sorted column name direct into SQL. My problem is that I can't use Hibernate or Seam -only RichFaces + POJOs + SQL.
Kuba
-
3. Re: How to catch sorting event on Extended Data Table
ilya_shaikovsky Dec 16, 2009 3:51 AM (in response to kubap.)The idea is not in using Hibernate or Seam but in implementing dataModel and implements Modifiable interface. Then you will able to process the sorting and filtering in modify method as you need. -
4. Re: How to catch sorting event on Extended Data Table
kubap. Dec 17, 2009 2:49 AM (in response to ilya_shaikovsky)Hi,
Im new in RichFaces. Could you provide steps should I do to get my requirement ? Now I have a List of POJOs from SQL result set. What classes and methods shoud I implement ?.
Kuba
-
5. Re: How to catch sorting event on Extended Data Table
eugenbesel Mar 9, 2010 3:28 AM (in response to kubap.)Hello Jakub, Ilja
have you implemented the model with method modify??
I tried to do it, but I have a problem. I use columns for generic DataTable and want to modify data when they are sortied.
in the method modify I take an expressionString from sortFields. but I get always the String as it stays in xhtml.
public void modify(List<FilterField> arg0, List<SortField2> sortFields) {
if (!sortFields.isEmpty()) {
final SortField2 sortFild = sortFields.get(0);
final Expression expression = sortFild.getExpression();
final String expressionString = expression.getExpressionString();
ordering = sortFild.getOrdering();
sortFieldName = getExpressionName(expressionString);
}
System.out.println("");
}
private String getExpressionName(String expressionString) {
return expressionString.substring(expressionString.indexOf('.') + 1, expressionString.indexOf('}'));
}here is my xHTML-code:
<rich:columns id="col_#{col}" value="#{userbbean.columns}"
selfSorted="true" sortBy="#{data[ind]}" sortOrder="#{myDataTable.sortOrders[col]}"
var="col" index="ind">I get always sortFieldName = #{data[ind] and not the value of the column
I also tried with
<rich:columns id="col_#{col}" value="#{userbbean.columns}"
selfSorted="true" sortBy="#{col}" sortOrder="#{myDataTable.sortOrders[col]}"
var="col" index="ind">but without success.
can you help me??
-
6. Re: How to catch sorting event on Extended Data Table
eugenbesel Mar 10, 2010 3:37 AM (in response to eugenbesel)can anybody help me?? -
7. Re: How to catch sorting event on Extended Data Table
konstantin.mishin Mar 10, 2010 8:35 AM (in response to eugenbesel)javax.el.Expression.getExpressionString() works as it should. See Javadoc of this method. -
8. Re: How to catch sorting event on Extended Data Table
eugenbesel Mar 11, 2010 3:19 AM (in response to konstantin.mishin)Hello Konstantin,
I think this is the wrong method I should use, because if I use getExpressionString for sortBy="#{data[ind]}" then I get data[ind]. this is the expression String but not the value.
I will just know in modify method which column should be sorted, which column is clicked
-
9. Re: How to catch sorting event on Extended Data Table
nbelaevski Mar 11, 2010 5:15 AM (in response to eugenbesel)Try getValue() method. -
10. Re: How to catch sorting event on Extended Data Table
eugenbesel Mar 11, 2010 5:19 AM (in response to nbelaevski)Hello Nick,
javax.el.Expression doesn't have method getValue()
which method getValue do you mean??
-
11. Re: How to catch sorting event on Extended Data Table
konstantin.mishin Mar 11, 2010 6:16 AM (in response to eugenbesel)javax.el.Expression can be cast to javax.el.ValueExpression or javax.el.MethodExpression. Use their methods. You should cast to javax.el.ValueExpression in your case. -
12. Re: How to catch sorting event on Extended Data Table
eugenbesel Mar 11, 2010 7:23 AM (in response to konstantin.mishin)you are right, I can cast the object to ValueExpression.
BUT
I get null when I make getValues(ELContext)
here is my code:
public void modify(List<FilterField> arg0, List<SortField2> sortFields) {
ELContext context = FacesContext.getCurrentInstance().getELContext();
if (!sortFields.isEmpty()) {
final SortField2 sortFild = sortFields.get(0);
final Expression expression = sortFild.getExpression();ValueExpression expr = (ValueExpression)expression;
Object ob = expr.getValue(context);
}
In this case ob is always null.
what is wrong on this code??
do I use the wrong context??
-
13. Re: How to catch sorting event on Extended Data Table
eugenbesel Mar 12, 2010 2:46 AM (in response to eugenbesel)can anybody help me on this point?
PLEASE...
-
14. Re: How to catch sorting event on Extended Data Table
nbelaevski Mar 12, 2010 4:20 AM (in response to eugenbesel)Eugene,
Please check the demo link that Ilya suggested. It uses rich:columns + ModifiableModel.