is changing the value of a cell possible?
is changing the value of a cell possible?
this_is_a_mess
Posts: 3Questions: 1Answers: 0
hi,
it really surprises me that something so basic is so complicated in datatables. i checked a lot of the related examples, but the whole library is just a huge mess.
i am also very perplexed about the different methods of selecting a row. somehow there is an extension for this but there is also some internal support for selecting stuff. should i use the select extension?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'm sorry to hear you don't like the API. The
cell().data()
method can be used to change a cell's value:The Select extension can be used for row selection. It provides the
row().select()
method.Allan
thank you very much for the answer. i just noticed how vague my question was. sorry for that!
what i want specifically is changing a cell in the row that i selected.
for example: i select a row; klick on a button; a function is called; a cell's value is changed.
the problem is i don't know how to get to the cell. at first i have to get the selected row.
i found some information on the internet and came up with the following line:
table.row('.selected').cell(':eq(5)').data("1234").draw();
or
table.rows( { selected: true } ).cell(':eq(5)').data("1234").draw();
the former is doing something, but in only changes the cell in the first row.
The
cell()
method accepts both row and column selectors (the intersection of which of course is a cell):See
cell()
for full details.Allan
thank you very much!