Search code examples
dojodijit.layout

Why does the Dojo API not include all related commands for specific types? (I'll describe better below.)


Just as an example, the "dijit/layout/ContentPane". In my sample code, which I found online and have been manipulating, this appears in the body of the new ContentPane():

new ContentPane({
     region: "top",
     "class": "edgePanel",
     content: "Header content (top)"
 })

My question pertains to why the term "region" is never mentioned in the Dojo API for the ContentPane. There are other examples of this, too.

Here is another example:

new ContentPane({
    region: "left",
    id: "leftCol", "class": "edgePanel",
    content: "Sidebar content (left)",
    splitter: true
})

"splitter" is never mentioned in the ContentPane API for Dojo. As far as I know, from the API, I would never even know I could specify "splitter: true" for a new ContentPane.

So my final question is: Is there somewhere I can find all types, "region" for example, that pertains to a given function? How would I ever know that I needed to specify using "region: "top"" if I hadn't found this code online?

Thanks guys.


Solution

  • BorderContainer regions can hold various widgets, not just ContentPanes, so documenting them on that specific class isn't ideal. At the same time, these properties only make sense on children of BorderContainers (e.g. not ContentPanes that are not children of BorderContainers).

    For this reason, these properties are documented as child widget properties of BorderContainer.

    The BorderContainer API docs specifically call out this separate location for documentation on child widget properties:

    See BorderContainer.ChildWidgetProperties for details on the properties that can be set on children of a BorderContainer.

    Note that there is a similar dedicated page for StackContainer child widget properties (which also applies to TabContainer and AccordionContainer since they extend StackContainer).

    The BorderContainer examples in the reference guide also include the region and splitter properties (though they don't particularly explain them).

    The Layout with Widgets tutorial explains regions rather thoroughly in its section on BorderContainer.