I have a datatable, and one of the columns contains the status of the particular item. The status appears as a commandLink in the column. If the status of the item as retrieved from the database is a comma separated value like Status1,Status 2, I have to display 2 commandlinks in the column for the same item namely, one with Status1 and another with Status 2.
<h:commandLink id="status1Link" value="#{pc_test.status1}"
onclick="showAssignKeyRvPopup(#{plist.t3Id},'#{plist.t3FileName}','#{plist.status}');return false;"
rendered="#{plist.status == 'Status1,Status2'}"
update="assignKeyRvDialog">
</h:commandLink>
The above is the code I'm using to display the commandLink. on click, it shows a popup, from which if I clcik OK, I have to perform an action that updates the status again. I have 2 commandLinks in the same column, my question is when I click on one commandLink and perform an action, I want the text of that commandLink only to change, not the other one. So, I need to pass the id of the commandLink that I click. Please let me know how I can go about doing this.
I tried just as you suggested -
<p:remoteCommand name="doSubmit" actionListener="#{pc_testmaps.doAssignUser}" />
<p:commandButton id="assignUser" value="Submit" onclick="doSubmit();"> </p:commandButton>
function doSubmit() {
document.getElementById('nonMCLink') = commandLinkId;
doAssignUser([{name:'commandLinkId', value:commandLinkId}]);
}
And in the bean,
public void doAssignUser() throws DelegateException {
FacesContext context = FacesContext.getCurrentInstance();
Map<String, String> map = context.getExternalContext().getRequestParameterMap();
String linkStatus = (String) map.get("commandLinkId");
System.out.println(linkStatus);
}
It still doesn't seem to work, when I print the linkStatus value, I'm getting it as null. Please help.