Exploring the functionalities of SlickGrid
'seditors
/formatters
, I delved into how these features could potentially alter the data
object utilized for constructing the grid (as modifications within the table are usually reflected in the original data
object).
While examining a specific example demonstrating how booleans
can be edited and formatted as checkboxes instead of dealing with explicit true
or false
strings, I noticed inconsistencies in the values that were propagated to the data
object.
To better illustrate my point, try editing the effortDriven
column for the initial 4 rows according to the following:
-Task 0: leave unchanged
-Task 1: mark as checked
-Task 2: leave unchanged
-Task 3: toggle between check and uncheck
Subsequently, open your firebug console and alert the data object:
The resulting values for the effortDriven
field will display as follows:
-Task 0: true
-Task 1: checked
-Task 2: false
-Task 3: (void 0)
Evidently, despite initially expecting a boolean
value for the field, we observe 4 distinct outcomes. Reflecting on this, it was previously assumed that the role of formatters/editors
was solely related to visualization while maintaining the integrity of the data
object: Hence, I strongly advise users of SlickGrid
to carefully monitor how their data
object is updated when implementing formatters/editors
, not assuming data integrity remains intact).
How can one ensure that the data
object preserves two boolean
values whilst utilizing checkbox elements in the interface?