The expanded(list, bool) method is used to set the expanded state of a list of items, referenced by their index.

It accepts two parameters - a list of zero-based indices of the items to expand/collapse, and a single boolean value, indicating whether to set those items as expanded (true) or collapsed (false).

<div id="accordion"></div>

<script type="text/javascript">
$(function () {
        mode: 'multiple',
        dataSource: {
            data: [
                    title: 'Perl',
                    content: 'A very good programming language'
                    title: 'C++',
                    content: 'Also very good for development'
                    title: 'JAVA',
                    content: 'Moderate stuff'

    // expand the first and last item
    $("#accordion").swidget().expanded([0, 2], true);

    // collapse the second item
    $("#accordion").swidget().expanded(1, false);