2
I want to make a refactoring
in my code, and for that I need to get the id of a component that suffered an action.
My target would be that I have two datatables
, and wanted to take the id
and from the id
define what action to take.
So I have the datatables
as shown below
I have within them the following calls to ajax in each table.
<p:ajax event="rowEditInit" onstart="disableBtnCorrenteExcluir();"/>
<p:ajax event="rowEdit" oncomplete="if (args.validationFailed) disableBtnCorrenteExcluir(); else enableBtnCorrenteExcluir();"/>
<p:ajax event="rowEditCancel" oncomplete="enableBtnCorrenteExcluir();" />
For each table I run methods to lock the Add Track, Edit Duration and Delete Duration buttons. What this in question is, if when I perform the above methods call in the specific events of the Primefaces
, will have to catch which object called it?
How can I do that?
Hello Macario, I reorganized the question to leave the question sequential. Feel free to reverse the edit if it hasn’t gotten good or changed what the doubt really was.
– Caputo
Macario, I could not quite understand what you intend to do. Know the ID of
datatable
depends a lot on the type of event you want to capture and where capture will be required. Maybe I or someone can help if you can try to detail a little more, maybe with examples of the code where the event is configured and the code where it is necessary to recover the ID.– utluiz
Great @utluiz, always helping, next guy, I have two
datatables
, and I do 4 methods, 2 for eachdatatable
. I wanted to do the following, pick up which component clicked, because inside thedatatable
has a button to delete. And then I wanted to pick which one was clicked, understood?– Macario1983
@utluiz sorry but updated the question again to make it clearer. I was leaving work and it was difficult to answer.
– Macario1983