dwr.util.toDescriptiveString
Description
dwr.util.toDescriptiveString is a nicer version of toString() than the default.
Parameters
- The first parameter is the object to pretty-print.
- The second parameter (optional) is the level of detail that we go to:
- 0: Short single value. For objects and arrays this means not descending into child objects and for strings it means printing a maximum of options.shortStringMaxLength characters.
- 1: One-line mode that includes a limited number (options.oneLineMaxItems) of child objects.
- 2: Multi-line mode that includes all first-level and a limited number of second-level child objects.
- 3: Multi-line mode that includes all first- and second-level plus a limited number of third-level child objects. And so on. Level 3 and greater may produce too much output.
- The third parameter (also optional) is an options object to further customize the display. The members of the options object can be:
- escapeHtml: Set to true when displaying output in an HTML element. Set to false when displaying in an alert() or textarea. Default: false
- baseIndent: A string that will be added as prefix to every line except the first. Default: empty string
- childIndent: A string to be added to each line recursing into deeper levels in data, once for each recursive level. Default: two hard Unicode spaces.
- lineTerminator: String will be added at end of each output line. Default: "\n"
- oneLineMaxItems: The maximum number of sub-objects to print on a line in one-line mode. -1 means no limit. Default: 5
- shortStringMaxLength: The maximum number of characters in a string to print on a line in one line mode. Default: 13
- propertyNameMaxLength: The maximum number of characters to print of property names in objects. Default: 30
Example of byId and dwr.util.toDescriptiveString
This paragraph has id="example", and
has
id="text".
dwr.util.toDescriptiveString(
,
)