why doesn't applying css to modifier() object work on drawCallback?
why doesn't applying css to modifier() object work on drawCallback?
h.causevic
Posts: 6Questions: 3Answers: 1
"drawCallback": function(settings){
console.log("drawCallback")
if (!settings._editor) return false
var modifier = settings._editor.modifier()
if (modifier){
//$(modifier).closest("tr").addClass("table-danger")
// --> should be ideal solution but doesn't work
// var domModifier = $(modifier)[0]
// domModifier.classList.add("table-danger")
// ---> doesn't work
//let trs = document.querySelectorAll("tr")
//trs.forEach((tr) => {
// tr.classList.add("table-danger")
//})
// ---> works, but doesn't really solve my problem since I only want to color the node's <tr> parent
}
},
I can't wrap my head around why relating to the modifier in any way just doesn't do anything.
it logs the proper element...
This question has accepted answers - jump to:
Answers
Can you give me a link to the page showing the issue please?
modifier()
will only return something useful when the table is in editing mode, and it is generally unusual to redraw the table at that point.Also, what
modifier()
returns depends totally on how the editing is being triggered. Generally I prefer usingids()
myself.Allan
i wish I could. currently in an internship and was asked to color the row whenever the cell values were changed. so if there's multiple changes -> color multiple
but what's basically happening is:
cell onclick fires an inline that applies a "preSubmit" event on the editor, which then fires a draw() whenever you hit enter to apply changes
ids() should technically do the job but only seems to store a single ID ever. Guess I could store them
ids()
will store multiple id's if multiple rows are in editing mode at the same time. You can see that on this page - select three rows, hit the edit button and then in the console runeditor.ids()
.Is the data only ever being updated through Editor here, or do you have something else (a websocket or polling Ajax perhaps?) updating the data as well. I feel I'm missing some information here.
Allan