|
To create a new listview for the page simply place this in your javascript code:
var listview = new IDC_Listview(object documentObject, object parentObject, int width, int height);
The first argument references to the document object, and can be left as null, if the document in use is the current.
The second argument is the parent object where the listview should be created.
Use document.getElementById(ID) to get the parent object or pass null, to add the listview directly to the body of the HTML document.
The third and fourth arguments are width and height passed as integers.
Column headers are needed to present items in the listview.
To add a new column header use:
listview.AddColumnHeader(string Text,int Width, string Align, string DataType);
The first argument is the visual text of the column header.
The second argument is the default width of the column header.
The third argument is the text alignment for the column header.
Possible values:
The fourth argument is the data type used for the column header.
Possible values:
To add new items to the listview use:
listview.AddItem(object Id, string Text, string[] Icons, string[] SubItems);
The first argument is the Id for the listview item. Add anything you want or null, if you don’t need an Id.
The second argument is the Text for the Item.
The third argument is an array of Icons for the listview. The array should point to images with the sizes:
- 16x16
- 32x32
- 48x48
- 64x64
- 96x96
- 128x128
You can exclude any sizes you don’t need for your listview, ie.
['images/icon16.gif','images/icon32.gif']
The listview will always attempt to get the closest matching icon, corresponding the the viewstate chosen.
The fourth argument is the subitems for the listview.
This is added in the same way as images, ie.
['Sub item 1', 'Sub item 2']
To get an array of the selected items use:
Listview.SelectedItems
This will return an array of the IDC_ListviewItem class
From here you can access a listview item by using:
var item = Listview.SelectedItems[index];
To delete one or more items, simply invoke
IDC_ListviewItem.Remove()
This will remove the item in question.

|