dojox/dtl/filter/lists (version 1.10)

Method Summary

  • _dictsort(a,b)
  • _unordered_list(value,tabs)
  • dictsort(value,arg) Takes a list of dicts, returns that list sorted by the property given in the argument.
  • dictsortreversed(value,arg) Takes a list of dicts, returns that list sorted in reverse order by the property given in the argument.
  • first(value) Returns the first item in a list
  • join(value,arg) Joins a list with a string, like Python's str.join(list)
  • length(value) Returns the length of the value - useful for lists
  • length_is(value,arg) Returns a boolean of whether the value's length is the argument
  • random(value) Returns a random item from the list
  • slice(value,arg) Returns a slice of the list.
  • unordered_list(value) Recursively takes a self-nested list and returns an HTML unordered list -- WITHOUT opening and closing <ul> tags.

Methods

_dictsort(a,b)
Parameter Type Description
a undefined
b undefined
Returns:number
_unordered_list(value,tabs)
Parameter Type Description
value undefined
tabs undefined
Returns:string
dictsort(value,arg)

Takes a list of dicts, returns that list sorted by the property given in the argument.

Parameter Type Description
value undefined
arg undefined
Returns:undefined | Array
dictsortreversed(value,arg)

Takes a list of dicts, returns that list sorted in reverse order by the property given in the argument.

Parameter Type Description
value undefined
arg undefined
Returns:undefined
first(value)

Returns the first item in a list

Parameter Type Description
value undefined
Returns:string
join(value,arg)

Joins a list with a string, like Python's str.join(list)

Django throws a compile error, but JS can't do arg checks so we're left with run time errors, which aren't wise for something as trivial here as an empty arg.

Parameter Type Description
value undefined
arg undefined
Returns:undefined
length(value)

Returns the length of the value - useful for lists

Parameter Type Description
value undefined
Returns:undefined
length_is(value,arg)

Returns a boolean of whether the value's length is the argument

Parameter Type Description
value undefined
arg undefined
Returns:boolean
random(value)

Returns a random item from the list

Parameter Type Description
value undefined
Returns:undefined
slice(value,arg)

Returns a slice of the list.

Uses the same syntax as Python's list slicing; see http://www.diveintopython.net/native_data_types/lists.html#odbchelper.list.slice for an introduction. Also uses the optional third value to denote every X item.

Parameter Type Description
value undefined
arg undefined
Returns:undefined
unordered_list(value)

Recursively takes a self-nested list and returns an HTML unordered list -- WITHOUT opening and closing <ul> tags.

The list is assumed to be in the proper format. For example, if var contains ['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]], then {{ var|unordered_list }} would return::

<li>States
<ul>
    <li>Kansas
    <ul>
        <li>Lawrence</li>
        <li>Topeka</li>
    </ul>
    </li>
    <li>Illinois</li>
</ul>
</li>
Parameter Type Description
value undefined
Returns:undefined
Error in the documentation? Can’t find what you are looking for? Let us know!