Primefaces datatable rowReorder get row -


i'm trying row object, in case of class story.class, while reordering row in primefaces datable. indexes, reorderevent, unfortunately not enough since have more 1 datatable reuse same rowreorder listener.

here code fragments:

<p:ajax event="rowreorder"                 listener="#{reorderstoryview.onrowreorder}" /> 

the following code line returns null:

story story2 = context.getapplication().       evaluateexpressionget(context, "#{story}", story.class); 

the following code line returns not current rowdata, have problems determine row data get:

story story =(story)((datatable)event.getcomponent()).getrowdata(); 

can't find additional information problem, maybe can me out.

thx in advance

/d

you can read source table adding line listener code:

string source = ((datatable)event.getsource()).getclientid(); 

an example listener method:

public void onrowreorder(reorderevent event) {     int = event.getfromindex();     int = event.gettoindex();     // source table     string source = ((datatable)event.getsource()).getclientid();     // or string source =  event.getcomponent().getclientid();     // access backing bean (require reordering in backing bean)     // reorderstoryview.stories.get(from)     // reorderstoryview.stories.get(to)     // access moved row table component     datatable mydatatable = (datatable) facescontext.getcurrentinstance()         .getviewroot().findcomponent(source);     story story = mydatatable.getrowdata();      ... } 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -