Opened 12 years ago
Closed 12 years ago
#9077 closed enhancement (fixed)
ItemFileReadStore should have an option to assume a flat data store
Reported by: | Phil DeJarnett | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | low | Milestone: | 1.4 |
Component: | Data | Version: | 1.3.0 |
Keywords: | ItemFileReadStore ItemFileWriteStore | Cc: | |
Blocked By: | Blocking: |
Description
ItemFileReadStore? currently assumes that it might be loading a hierarchical data store, and loads any object as a nested item within the containing item.
Even though this is the "expected" behavior, this can cause problems in two ways:
1) New users to the system attempting to store complex data into a node are often confused as to why a simple object has been changed (such that the properties of that object have all been converted to arrays). There are at least 2 filed-and-closed bugs in the database already about this.
2) If a developer is switching between different DataStores?, for example, the QueryReadStore? and the ItemFileReadStore? depending on need, completely different and unexpected things happen. (In my case, I use a QueryReadStore? for displaying values in a Grid, and ItemFileReadStore? when those items are being edited on a different page. They are both served by the same server-side controller.)
Since only ItemFileReadStore? supports the complex typeMap, that isn't a very good solution in 2, and is overly complex in 1. In many ways, the store has been overcomplicated for a less-common usage, namely hierarchical stores.
I propose a new property on ItemFileReadStore?, flatStore, which defaults to false (for compatibility). When this is true, the isItem method should always return false, preventing value-items from being added as a child node, and instead they are simply stored as a single value (or array of values) for the item.
Attachments (2)
Change History (5)
comment:1 Changed 12 years ago by
Changed 12 years ago by
Attachment: | hierarchy_disable.patch added |
---|
Patch to allow disabling of parsing 'child' object structures as items.
Changed 12 years ago by
Attachment: | AndOr_hierarchy_disable.patch added |
---|
Same patch for AndOr? store.
comment:3 Changed 12 years ago by
Milestone: | tbd → 1.4 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
It's not only expected behavior, it's highly documented behavior and is described in detail, with examples, in ItemFile?*Store documentation and in the dojo.data faq:
http://docs.dojocampus.org/dojo/data/ItemFileReadStore http://docs.dojocampus.org/quickstart/data/usingdatastores/faq (http://docs.dojocampus.org/quickstart/data/usingdatastores/faq#question-9-in-one-of-my-items-in-itemfilereadstore-i-defined-an-attribute-value-as-a-javascript-object-when-i-access-it-through-store-getvalue-it-has-been-modified-why)
I'll think on this and debate if it should be done.