In order to edit the row, it seems that we just want to edit the description text since the input checkbox will stay the same. I have tried adding a label property to Row and executing this.label.text(description)
where description is the updated description. But this also removes the input element inside the label. Any ideas?
Hello @ballgeier!
Right - the .text
method will replace everything inside of an element (and not just the text).
These are just a few options:
- When you create a Row, you could put the description text inside of an element, with a data attribute to select by.
- You could create a new Row with the updated description, and then use jQuery to insert the new Row after the old Row (then delete the old Row) - a web search for the jQuery documentation will take you to the method you need.
- Or, for a shorter version of the previous suggestion: jQuery might have a way to replace one element with another element (again, a quick web search will point you to the right method)
- Finally, here’s a very thorough way to go about it - you could keep track of the order of your coffee orders when you store the data. Then, when you update the data, you redraw the entire CheckList. The Rows would appear to be in the same order, giving the impression that you updated the data in-place.
Do any of those help?
Let me know!
-Chris