How to check if a cell exist?
How to check if a cell exist?
rogerr
Posts: 1Questions: 1Answers: 0
I have a keytable where I'm trying to give focus on the same point where it was previously, after removing a row. This most of the time work with
var activecell = myTable.table.cell( {focused:true}).index();
<Some code that does something with the row and removes it>
myTable.table.cell(activecell).focus();
Now, this works, as long as there is a cell to replace the previously removed. But when there isn't, everything gets totally messed up.
So i want something like:
if(activecell.exist){
myTable.table.cell(activecell).focus();
}
Does such a thing exist? I tried some different things, but whenever I tried to get any sort of info on about cell that don't exist, datatables just crashes.
This discussion has been closed.
Answers
In my usage, I don't check for cells, but I do check for rows.
If you assign an ID to each row, then is just a simple jQuery check