View Full Version : [SOLVED] How do I fetch cell three's innerHTML from my grid?

17 Jun 2007, 11:22 AM
Hey everyone,

I have a simple question. I have a grid with five headers. The grid has 10 rows. When I click on a row, I want to "fetch" the innerHTML of cell 3 of the row I clicked.

How can I do this?

In advance, thank you.


18 Jun 2007, 7:17 AM
Do you actually want the innerHTML or the value of the field? The value is easy and robust to get to, but the innerHTML should have a try/catch around it.
Here's both...

function getInnards(grid, rowIndex, e) {
var row = grid.dataSource.getAt(rowIndex);
// you should test to make sure that row.fields.keys[2] exists...
var title = row.fields.keys[2]; // or if you know your data index you can say 'var title=index;'
var value = row.data[title];
function getInnards2(grid, rowIndex, e) {
var innerHTML = grid.view.mainBody.dom.firstChild.firstChild.rows[rowIndex].childNodes[2].innerHTML;
grid.on('rowclick', getInnards);
grid.on('rowclick', getInnards2);

let me know if this helps

20 Jun 2007, 4:03 AM
Sorry for the late reply.


Taking the value instead of the innerHTML, is better. So I will use that bit of code.
Thank you very much, for your help :)