List.clear

Syntax

clear (withDispose: Boolean);

Parameters

withDispose. If the parameter value is True, the objects are deleted, if it is False, the objects are removed from the list of elements PP.List.

fireEvent. Determines whether an appropriate event is fired on calling the method. If the value is set to True, the event is fired, otherwise it is not.

Description

The clear method removes all objects from the collection.

Example

To execute the example on HTML page in the HEAD tag, add links to the PP.css and PP.js component library. Create a Breadcrumb component with three elements, two of which are selected and a button that removes elements from breadcrumb:

    var bread = new PP.Ui.Breadcrumb({

        ParentNode: document.getElementById("bc1"),

        Width: 400,

        Items:

          [

                { Content: "Item1", Id: "el1" },

                { Content: "Item2", Id: "el2" },

                { Content: "Item3", Id: "el3" }

          ],

        SelectedItems: [0,1]

    });

    var b1 = new PP.Ui.Button({ ParentNode: "b1", Content: "Clear" });

    b1.Click.add(function (sender, args){

    bread.getSelectedItems().clear(false)});

After executing the example the Breadcrumb component and the button with the Clear button will be placed on HTML page, to remove selected elements from breadcrumb. If the True value is set for the withDispose parameter, the items are removed from the component completely.

See also:

List