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

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

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -