webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
796 stars 271 forks source link

applyEditing function bad for custom converters #25

Closed jangins101 closed 11 years ago

jangins101 commented 12 years ago

In trying to write my own converters (convertTo for display, convertFrom for model update) I found that the applyEditing method updated the display prior to updating the model (and calling the modelChanged event). In my attempts to emulate a to (render) and from (editor) converter, this seems logically backwards.

My recommendation would be to use the editableGrid.getValueAt method to get the previousValue first, then update the model if the value is different, and then call the setValueAt method. It would seem to flow more logically from a programmatic perspective. (Note: this method I believe starts on line 158 of the editablegrid_editors.js)