Sort function from p:column is not even invoked!

UI Components for JSF
Post Reply
arvasko
Posts: 36
Joined: 23 Nov 2010, 15:25

04 Apr 2011, 16:36

I need to implement my own sort function do a dataTable. So I read the manual, copied a simple sort function and tested! But the function is not even invoked, I don't get error, nothing!

Please, have anyone succeed with sort functions?

My XHTML:

Code: Select all

<p:column sortBy="#{item.title}" sortFunction="#{bean.mySort}">
                        <f:facet name="header">
                            <h:outputText value="Title"/>
                        </f:facet>
                        <h:outputText value="#{item.title}"/>
</p:column>
My Bean:

Code: Select all

public int mySort(String s1, String s2) {
        // just print something so I know this function is being invoked:
        System.out.println("mySort" + s1 + "/" + s2);
        return 0;
    }
I don't get anything on the console. So I think my function is not even being invoked by Primefaces's p:column.

Can anyone help me? Maybe post some examples that work.

Thanks!

(Primefaces 2.2-RC2 / GlassFish v3)

arvasko
Posts: 36
Joined: 23 Nov 2010, 15:25

08 Apr 2011, 16:00

I'm really stuck here! Can someone gimme the light? :)

callahan
Posts: 768
Joined: 27 May 2010, 22:52

08 Apr 2011, 16:15

Does it work if the parameters are Objects rather than Strings?

Code: Select all

public int mySort(Object s1, Object s2) {
        // just print something so I know this function is being invoked:
        System.out.println("mySort" + s1 + "/" + s2);
        return 0;
    }

arvasko
Posts: 36
Joined: 23 Nov 2010, 15:25

08 Apr 2011, 17:52

Yes, thank you a lot!

rikhurana
Posts: 3
Joined: 04 Feb 2015, 17:58

05 Oct 2016, 11:05

Hi,

Can you kindly advise how PF picks up object s1 and s2 to feed to sortFunction
public int mySort(Object s1, Object s2)

I receive error: Method not found as in the xhtml, I am not inputting any variables s1 and s2.

Thanks,
Richa

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 56 guests