I have an existing function, which takes a cellobj as input parameter e.g.
MyFunction(cellObj)
This is used when somebody clicks on a cell in a table, and the HTML in the table will look like this:
MyFunction(this) //this is the cellObj
Now I need to call the exact same function, but I am not in the table, I am looping through the rows
and I cant pass “this”, as it is a row object and not a cell object.
My question thus is how to get the cellobject from a rowobject please
e.g.
$("#gv tr:has(td)").each(function () {
var cellObj = $(this)........
MyFunction(cellObj);
})
So you’re in the row, and you need to get each of the cells in turn to pass them to your function, so all you have to do is find the cells from the row, and loop through them, in exactly the same way you did to get and loop through the rows of your table.
This should do the trick:
Use that instead of
var cellObj = $(this)...etc.Edit:
To execute it only once per row, try…
Though I feel that if you are doing it this way, that maybe your code is not structured efficiently. I would put the line that finds the cellObj inside your function, and pass your function each row instead.