Reputation: 83
If I have the following table:
I want one Controller function A invoked when the red dot is clicked on any row but function B invoked when the edit icon is click on any row.
I have successfully gotten one function to be invoked when clicking the red dot on any row with this javascript:
var myTable = document.getElementById('indivTble');
if (myTable != null) {
rows = myTable.getElementsByTagName('tr');
var selectedUniqueId, selectedSecondaryId;
for (var i=1,len=rows.length; i<len; i++) {
rows[i].onclick = function() {
selectedUniqueId = this.cells[2].innerHTML;
selectedSecondaryId = parseInt(this.cells[3].innerHTML);
<g:remoteFunction controller="customer"
action="editRecord"
update="flagsSummary"
params="{uniqueId: selectedUniqueId, secondaryId: selectedSecondaryId}"/>
but I am having trouble binding the second function to the edit icons which is:
<g:remoteFunction controller="customer"
action="displayRecordDetails"
update="flagsSummary"
params="{uniqueId: selectedUniqueId, secondaryId: selectedSecondaryId}"/>
I would greatly appreciate any help thanks.
Upvotes: 0
Views: 45
Reputation:
Try this:
for (var i=1,len=rows.length; i<len; i++) {
rows[i].cells[0].onclick = function() {
selectedUniqueId = this.parentNode.cells[2].innerHTML;
selectedSecondaryId = parseInt(this.parentNode.cells[3].innerHTML);
<g:remoteFunction controller="customer"
action="editRecord"
update="flagsSummary"
params="{uniqueId: selectedUniqueId, secondaryId: selectedSecondaryId}"/>
}
}
for (var i=1,len=rows.length; i<len; i++) {
rows[i].cells[1].onclick = function() {
selectedUniqueId = this.parentNode.cells[2].innerHTML;
selectedSecondaryId = parseInt(this.parentNode.cells[3].innerHTML);
<g:remoteFunction controller="customer"
action="displayRecordDetails"
update="flagsSummary"
params="{uniqueId: selectedUniqueId, secondaryId: selectedSecondaryId}"/>
}
}
Upvotes: 1