Tabulator: How to get the value of a cell that is not the current cell in a cellClick

Created on 10 Oct 2017  路  2Comments  路  Source: olifolkerd/tabulator

Hi, First of all, I want to say Thank you! for your really impressive and awesome work.
I wonder how to get the value of another cell in a cellClick, something like this:

$('#my-table').tabulator({
    { title: "The title", field: "id", ...}
    { title: "The name", field: "name",
        cellClick: function(e, cell){
            window.location.href = "/Some/Path/" + fields.id;
        }
    }
});

Is it possible?

Thank You!

Question - Ask On Stack Overflow

All 2 comments

Hey @joalcava

Thanks for your kind words,

Is it a cell in the same row? If so you can call the getData function on the cell that was clicked that will return the data object for the whole row:

$('#my-table').tabulator({
    columns:[
        { title: "The title", field: "id", ...}
        { title: "The name", field: "name",
            cellClick: function(e, cell){
                window.location.href = "/Some/Path/" + cell.getData().id;
        }
    ]
});

Let me know if that helps,

Cheers

Oli

Hi @olifolkerd, That's just what I was looking for. Again thank you so much.

Was this page helpful?
0 / 5 - 0 ratings