Для выполнения примера в теге HEAD подключите ссылки на библиотеку компонентов PP.js и таблицы визуальных стилей PP.css. В теге BODY добавьте элемент DIV с идентификатором «container». Добавьте картинку, содержащую список пиктограмм вершин.
Подключим скрипт, генерирующий случайные вершины:
<script src="genJson.js" type="text/javascript"></script>
В тег <script> добавим следующий код:
// Создадим вершины var json = genJson(5540, 254, false, 123457);
// Создадим компонент
var t, treelist;
t = treelist = new PP.Ui.WrappedTreeList({
ParentNode: 'container',
DataObject: json,
DataMappers: {
Key: 'k',
Index: 'i',
Parent: 'p',
Content: new PP.PropertyMapper({
Getter: function (item) { return item.a.it },
Setter: function (item, value) { item.a.it = value; },
Context: null
}),
Selected: 's',
FixedSelected: '@fs',
Expanded: 'e',
ChildrenCount: '@cc' }, Width: 700, Height: 550, ShowCheckBoxes: true, EnableSort: true, ShowCaptions: true, EnableResizeColumns: false, EnableColumnsMenu: true,
EnableEdit: true,
ShowTree: true,
Style: {
Release: {
Font: {
Size: 13,
FontFamily: "Bookman Old Style",
IsBold: false
}
}
},
Captions:
[{
Content: 'first',
Width: '36%'
},{
Content: 'second',
Width: '11%'
},{
Content: 'third', Width: '53%' } ], });
В результате выполнения примера был создан компонент WrappedTreeList.
См. также: