Onclick javascript on click of any field in row of skuid table

  • 1
  • Question
  • Updated 2 years ago
  • (Edited)
I have created a table in my skuid page. now on click of any field in the row of that table , i want to do some operation through javascript.

So is it possible to write the javascript on click of that field? Af of now i have created one row action and performing the operation but it is not user friendly.

Can anyone please help me on this urgently? Thanks in advance!
Photo of Sumeet Sangle

Sumeet Sangle

  • 452 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
Photo of JG GBC

JG GBC

  • 694 Points 500 badge 2x thumb
Have you thought about using a queue instead?

If you want to do it with a table you can use the following snippet:

var $ = skuid.$;
$('.actionOnRowTable tr').on('click', 'td', function(event) {
if($(event.currentTarget).find('.fa-eye').length <= 0) {
$(event.currentTarget.parentElement).find('.fa-eye').click();
}
});

Replace "actionOnRowTable" with the class of your table and "fa-eye" with the class of your row action icon.

Execute this snippet on page load and on model requery.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
You may be able to replace the standard fields with template fields. In the templates, you may be able to use a combination of merge syntax to bring in the fields you want and JavaScript to execute the in-click actions.
Photo of Sumeet Sangle

Sumeet Sangle

  • 452 Points 250 badge 2x thumb
Hi Raymond ,

Is it possible to get the id of row or the row record which was clicked (anyone from table), without using item.row ?

because using model.getfirstrow() gives me only first row id even though i clicked on 2nd row.


Thanks in Advance!