Check documentation for the latest version 6.0 of dhtmlxSuite dhtmlxTree DHTMLX Docs

dhtmlxTree

get_check_state

returns the state of the selected item.

$dataItem->get_check_state();

Returns:

  • state of checkbox related to the item:
  • '0' - unchecked
  • '1' - checked.
  • '-1' - third (custom) state.

See also:

get_id

returns the id of an item.

$dataItem->get_id();

See also:

get_index

returns the index of the currently selected item (for example, in grid, it will be the index of a row )

$dataItem->get_index();

Parameters:

  • none

get_parent_id

returns the parent id of the selected item.

$dataItem->get_parent_id();

Parameters:

  • none

get_value

returns the value of a field.

$dataItem->get_value($name);

Parameters:

  • $name - name or alias of the field.

See Also:

set_attribute

allows you to set some attribute for a item.

$dataItem->set_attribute($name, $value);

Parameters:

  • $name - the name of an attribute.
  • $value - the value that an attribute is set to.

set_check_state

allows you to set the state of the checkbox related to an item.

$dataItem->set_check_state($value);

Parameters:

  • $value - state of the item.

    Valid values are:

  • '0' - unchecked.

  • '1' - checked.
  • '-1' - third custom state. See also:

  • get_check_state

set_id

sets the id of an item.

$dataItem->set_id($value);

Parameters:

  • $value - id of the item.

See also:

set_image

allows you to set image for any item in tree.

$dataItem->set_image($img);

Parameters:

  • $img - relative path to image which will be set for a item.

Description:

  • Can be used with variable number of parameters.
$dataItem->set_image($img1,$img2,$img3)
  • $img1 - image of folder in opened state
  • $img2 - image of folder in closed state
  • $img3 - image of leaf item

set_kids

allows you to mark an item as a leaf or branch of tree.

$dataItem->set_kids($is_enabled);

Parameters:

  • $is_enabled - (boolean) specifies whether an item must be marked as a branch.
  • true - item will be marked as a branch.
  • false - item will be marked as a leaf.

See also:

skip

ignores the current item while rendering output. Allows you to define custom filtering rules.

$dataItem->skip()

Parameters:

  • none

set_value

sets the value of a field.

$dataItem->set_value($name,$value)

Parameters:

  • $name - name or alias of the field
  • $value - value of the field in question

See Also:

set_userdata

(available from version 1.5)

sets user data for the item.

$dataItem->set_userdata($name,$value)

Parameters:

  • $name - the user data name
  • $value - user data string

See also:

Back to top