Hi all,
I would like to know how I could get/ set the css class of a particular cell in JavaScript? Thanks.
Hello aschoi,
You can get a particular cell by the row and column indices using the cellAt method:
var cell = $('#grid1').igGrid('cellAt', 1, 1);
Then you can get/set the class like this:
var class = $(cell).attr('class');
$(cell).addClass('red');
Please let me know if you have any other questions.
Internally, we have created a JavaScript cell object wrapper to wrap a cell. Right now, we would like to add a css property to this cell object that represents the class of the td element of the cell. Currently, I do not know how to get to the class of a td element from the ui element in a EditCellStarting event. I tried to use something like $(ui.editor.parent()).closest("td").ClassName but not working. Could you please help? thanks.
Hello Aschoi,
You can get the td element from the ui element like below:
ui.owner.element.find("tr td:nth-child(4)").css("text-align", "center");
Please let me know if I can provide any further assistance regarding this matter.