I'm currently trying to implement a custom editor for a few columns in my grid (the grid is using inline editing of remote data). The columns in question hold array or object values. I've been playing with Treema (
http://codecombat.github.io/treema/), and I believe I am most of the way there to having it working nicely within the grid as a custom editor of json objects or arrays.
Anyhow, with those details in mind, I need to modify a column's custom editor's return value to rowData. A couple of issues I need help with resolving to get it 100% of the way there:
1) When using a column editor's getData property (defined as a function), its return value gets put into the 'root' of rowData. In the case of an object, returning something like
{ foo1: foo1val, foo2: foo2val }
from getData ends up creating rowData.foo1 and rowData.foo2. However, I'd like to actually have an object (for instance 'foos') with two properties (i.e. foo1 and foo2) end up in the root of rowData instead. Is there a way to return an object to rowData that will allow this to happen?
2) When implementing a column editor's getData function for more than one column in the grid, it appears that only the getData function of the last column that was edited actually gets fired when clicking the row's 'Update' button. Shouldn't every column's editor.getData fire when a row's update is called? (if such a function is defined for that column) Or perhaps I'm not understanding how a column editor's getData is designed to function? In actuality, I'd prefer to modify rowData values much earlier than getData currently fires. It currently fires when the row's Update button is clicked, but would rather have this happen when finished column editing, such as during the editorEnd event. However, I'm having difficulty accessing the column's old values AND new values in the editorEnd event. The changes aren't returned via getChanges, and I'm not seeing them in the function's ui object either.
3) Number 2 could potentially be related to this, but at least initially seems to be a separate issue. Upon editing a column's value using a custom editor, the cell's 'pq-cell-dirty' is not applied. Is there a best practice for doing this for custom editors? Should this be done in the editorEnd or cellBeforeSave method (for instance)? In any case, I would need to be able to check the cell's previous value against its newVal to ensure it has in fact changed before making it dirty. The first challenge at the moment is to ensure that ui.newVal is populated when cellBeforeSave event fires on a column with a custom editor. Currently, it is undefined.
Please help! I'm so close, yet so far.