Login Register Help
API Documentation
Choose a stylesheet:

Constructordojox.data.jsonPathStore

Usage

var foo=new dojox.data.jsonPathStore(options); (view source)
parametertypedescription
options  

Jump to PropertiesFunctionsBack to top

FunctionbuildIndex(path: String, item)
parse the object structure, and turn any objects into jsonPathStore items. Basically this just does a recursive series of fetches which itself already examines any items as they are retrieved and setups up the required meta information.
FunctioncleanMeta(data, options)
FunctioncontainsValue(item: Object, attribute: String, value: anything)
Checks to see if 'item' has 'value' at 'attribute'
FunctiondeleteItem(item)
Functiondump(options)
exports the store data set. Takes an options object with a number of parameters data: /* object */ Defaults to the root of the store. The data to be exported. clone: /* boolean */ clone the data set before returning it or modifying it for export cleanMeta: /* boolean */ clean the meta data off of the data. Note that this will happen to the actual store data if !clone. If you want to continue using the store after this operation, it is probably better to export it as a clone if you want it cleaned. suppressExportMeta: /* boolean */ By default, when data is exported from the store some information, such as as a timestamp, is added to the root of exported data. This prevents that from happening. It is mainly used for making tests easier. type: "raw" || "json" Defaults to 'json'. 'json' will convert the data into json before returning it. 'raw' will just return a reference to the object
Functionfetch(args)
fetch an item by its identity. This store also provides a much more finger friendly alias, 'byId' which does the same thing as this function. If provided a string this call will be treated as a SYNC request and will return the identified item immediatly. Alternatively it takes a object as a set of keywordArgs: identity: /* string */ the id of the item you want to retrieve mode: dojox.data.SYNC_MODE || dojox.data.ASYNC_MODE overrides the default store fetch mode onItem: /* function */ Result call back. Passed the fetched item. onError: /* function */ error callback.
Gets the available attributes of an item's 'property' and returns it as an array. If the store has 'hideMetaAttributes' set to true the attributed identified by 'metaLabel' will not be included.
return the store feature set
returns the attributes which are used to make up the identity of an item. Basically returns this.idAttribute
FunctiongetLabel(item)
returns an array of attributes that are used to create the label of an item
FunctiongetValue(item: Object, property: String)
Gets the value of an item's 'property'
FunctiongetValues(item: Object, property: String)
Gets the value of an item's 'property' and returns it. If this value is an array it is just returned, if not, the value is added to an array and that is returned.
FunctionhasAttribute(item: Object, attribute: String)
Checks to see if item has attribute
FunctionisDirty(item)
FunctionisItem(item: Object)
Checks to see if a passed 'item' is really a jsonPathStore item. Currently it only verifies structure. It does not verify that it belongs to this store at this time.
returns isItem() :)
FunctionloadItem(item)
returns true. Future implementatins might alter this
FunctionnewItem(data: Object, options: Object)
adds a new item to the store at the specified point. Takes two parameters, data, and options.
FunctiononDelete(deletedItem: item)
See dojo.data.api.Notification.onDelete()
FunctiononLoadData(data)
FunctiononNew(newItem: item, parentInfo: Object?)
See dojo.data.api.Notification.onNew()
notification of the revert event..not part of the notification api, but probably should be.
FunctiononSave(items)
notification of the save event..not part of the notification api, but probably should be. console.log("onSave() ", items);
FunctiononSet(item: item, attribute: attribute-name-string, oldValue: Object|Array, newValue: Object|Array)
See dojo.data.api.Notification.onSet()
Functionsave(kwArgs)
Takes an optional set of keyword Args with some save options. Currently only format with options being "raw" or "json". This function goes through the dirty item lists, clones and trims the item down so that the items children are not part of the data (the children are replaced with reference objects). This data is compiled into a single array, the dirty objects are all marked as clean, and the new data is then passed on to the onSave handler.
FunctionsetData(data)
set the stores' data to the supplied object and then load and/or setup that data with the required meta info
FunctionsetValue(item, attribute, value)
sets 'attribute' on 'item' to 'value'
FunctionsetValues(item, attribute, values)
sets 'attribute' on 'item' to 'value' value must be an array.
Functionsort(a, b)
FunctionunsetAttribute(item, attribute)
unsets 'attribute' on 'item'
Function_addReference(item, pInfo)
make sure we have an reference to the item in the store and not a clone. Takes an item, matches it to the corresponding item in the store and if it is the same, returns itself, otherwise it returns the item from the store.
Function_loadData(data)
load data into the store. Index it if appropriate.
Function_makeItAnItem(data, pInfo)
Function_markClean(item)
Function_mixin(target, data)
specialized mixin that hooks up objects in the store where references are identified.
Function_setDirty(item)
adds an item to the list of dirty items. This item contains a reference to the item itself as well as a cloned and trimmed version of old item for use with revert.
Function_trimItem(item)
copy an item recursively stoppying at other items that have id's and replace them with a refrence object;
Function_updateMeta(item, props)
verifies that 'item' has a meta object attached and if not it creates it by setting it to 'props' if the meta attribute already exists, mix 'props' into it.

Jump to FunctionsPropertiesBack to top

Navigating the Dojo API Tool

There are several different methods of navigating through the object structure of the Dojo Toolkit:

  • Use the namespace list (to the left). The simplest method would be to use the list of namespaces defined by the Dojo Toolkit, on the left side of every page.
  • Drill-down from where you are. The API Tool was designed to give you as much information via drill-down as possible. Everything defined in an object can be clicked on, for more information.
  • Use the search. At the top of the namespace list to the left is a search box; type in the terms you are looking for, and you will be taken to a result page that spans the entire toolkit.
Move to different sections

In addition, objects with large numbers of contained types have a simple way of jumping to sections on a page; simply look at the right side of any heading, and you will see a set of quick navigation icons. Clicking a type icon will take you to that section; clicking the up arrow icon will return you to the top of the page.

Inherited and private members

Show or hide variable types

The Dojo API Tool will show the full ancestry of an object's members (including how that member was defined and whether or not it overrides an original). By default, all members of an object that are inherited are shown with the object's API listing, and all private members are hidden.

To toggle either inherited or private members, look just beneath the breadcrumb bar (above the name of the object you are viewing) and click the appropriate link.

Switching styles

Choose a style

The Dojo API Tool was designed with several themes in mind; we know that some people prefer light on dark, while others might prefer dark on light. With this in mind, two themes (Noir and Blanc) are currently available, with more on the way.

To switch visual styles, click on the theme you want to use, near the top right corner of the page. The API Tool will remember which style you prefer and automatically load that theme on subsequent visits.

Key/Legend

Namespace Namespaces
A namespace in Dojo parlance is an object/property bag that can contain almost anything: constructors, methods, properties, etc. Usually is expressly defined to serve a particular purpose; for example, dojo.date.locale is a namespace defined to deal with locale-specific date handling.
Constructor Constructors
A constructor is a function designed to create instances of objects. With the Dojo Toolkit, there are two ways of creating constructors: the "old school" way (i.e. defining a function with the this keyword in the body) or using dojo.declare.
Singleton Singletons
A singleton is a constructor that is defined and then immediately executed so that only one instance may ever exist during an application's lifetime. Usually this is done to capture some information in the environment, or to ensure a set of private variables that cannot be accessed from outside of the declaration. Examples include dojox.encoding.crypto.Blowfish.

Data Types

Array Array
Arrays are ordered lists, native to Javascript.
Boolean Boolean
Native data type representing a simple "true/false" value.
Date Date
Native Javascript data type to handle common date and time representations.
DOMNode Node
An object that represents any kind of element being referenced/used by Javascript code. Note that the type of element is not dictated by this data type; only that it is a node of some sort.
Error Error
A special, native Javascript object used to indicate an error in code. Can be subclassed and used in conjunction with the throw statement, i.e. throw new MySubError(...);
Function Function
Functions/methods are pieces of invocable code; in JavaScript, they are also considered data and can be passed around like any other object.
Number Number
A Number object is used to represent any kind of numeric value; note that Javascript does not guarentee the actual underlying datatype (though the most common is a 64-bit float).
Object Object
Objects are the base data type of Javascript. With the Dojo API Tool, a type that cannot be determined is usually marked with this icon, in addition to straight objects.
Regular Expression RegExp (Regular Expression)
A regular expression is an object used for fast string search and parsing.
String String
A string is any sequence of characters.

Input formats

  • Filtered HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

      This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy.

      For more information see W3C's HTML Specifications or use your favorite search engine to find other sites that explain HTML.

      Most unusual characters can be directly entered without any problems.

      If you do encounter problems, try using HTML character entities. A common example looks like &amp; for an ampersand & character. For a full list of entities see HTML's entities page.

    • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.
  • PHP code:
    • Using custom PHP code

      If you know how to script in PHP, Drupal gives you the power to embed any script you like. It will be executed when the page is viewed and dynamically embedded into the page. This gives you amazing flexibility and power, but of course with that comes danger and insecurity if you do not write good code. If you are not familiar with PHP, SQL or with the site engine, avoid experimenting with PHP because you can corrupt your database or render your site insecure or even unusable! If you do not plan to do fancy stuff with your content then you are probably better off with straight HTML.

      Remember that the code within each PHP item must be valid PHP code - including things like correctly terminating statements with a semicolon. It is highly recommended that you develop your code separately using a simple test script on top of a test database before migrating to your production environment.

      Notes:

      • You can use global variables, such as configuration parameters, within the scope of your PHP code but remember that global variables which have been given values in your code will retain these values in the engine afterwards.
      • register_globals is now set to off by default. If you need form information you need to get it from the "superglobals" $_POST, $_GET, etc.
      • You can either use the print or return statement to output the actual content for your item.

      A basic example:

      You want to have a box with the title "Welcome" that you use to greet your visitors. The content for this box could be created by going:

      print t("Welcome visitor, ... welcome message goes here ...");
      								

      If we are however dealing with a registered user, we can customize the message by using:

      global $user;
      if ($user->uid) {
      	print t("Welcome $user->name, ... welcome message goes here ...");
      }
      else {
      	print t("Welcome visitor, ... welcome message goes here ...");
      }
      								

      For more in-depth examples, we recommend that you check the existing Drupal code and use it as a starting point, especially for sidebar boxes.

  • Full HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.
  • Markdown:
    • Quick Tips:
      • Two or more spaces at a line's end = Line break
      • Double returns = Paragraph
      • *Single asterisks* or _single underscores_ = Emphasis
      • **Double** or __double__ = Strong
      • This is [a link](http://the.link.com "The optional title text")
      For complete details on the Markdown syntax, see the Markdown documentation.