An item can be deleted by one of the following actions:
- Right-clicking on an item and choosing 'Remove' from the menu
- Clicking the Klip's Menu button and choosing 'Remove all'
- Making a call to Items.remove(), Items.clear(), or Items.purge() in your JavaScript
The Items.Deleted[] Array
When an item is deleted from an Items[] array, it is added to the Items.Deleted[] array.For example, let's say there are three items in your Klip as illustrated below:
Example
The following Klip adds two items to the Klip, then calls Items.remove() to remove the second item.
<klip>
<identity>
<title>
API: Items.Deleted
</title>
</identity>
<locations>
<contentsource>
http://support.klipfolio.com/files/demo/demo.xml
</contentsource>
<icon>
http://www.klipfolio.com/static/klips/klipfolio/sample_icon.png
</icon>
<banner>
http://www.klipfolio.com/static/klips/klipfolio/sample_banner.png
</banner>
</locations>
<style>
alert {
type: item;
}
sender {
itemcol: 2;
noterow: 1;
label: 'Sender';
emphasis: strong;
}
summary {
itemcol: 3;
noterow: 4;
wrap: false;
notelabel: false;
}
date {
itemcol: 4;
noterow: 2;
label: 'Date';
}
category {
noterow: 3;
label: 'Category';
}
level {
itemcol: 1;
noterow: 5;
notelabel: false;
type: image;
}
url {
type: link;
}
id {
key: override;
}
</style>
<klipscript>
<![CDATA[
function onRefresh()
{
_t( "onRefresh () -- " + Prefs.contentsource );
var result = Engines.Data.process ( Prefs.contentsource );
Items.remove( 1 );
show_state();
return result;
}
//
// Support functions -----------------------------------------------
//
//
// Useful Debug Code -----------------------------------------------
//
var button;
function show_state()
{
show_items ();
show_itemsDeleted ();
show_all_prefs ();
}
function show_items()
{
if (Items.length == 0)
{
trace ("There are no items in the Items[] array\r\n");
return;
}
for( i = 0; i < Items.length; i++ )
{
trace ("Items[" + i + "]: \r\n");
queryItem (Items[i]);
}
}
function show_itemsDeleted()
{
if (Items.Deleted.length == 0)
{
trace ("There are no items in the Items.Deleted[] array\r\n");
return;
}
for (i = 0; i < Items.Deleted.length; i++)
{
trace ("Items.Deleted[" + i + "]: \r\n");
queryItem ( Items.Deleted[i]);
}
}
function queryItem( item )
{
trace( "-----------------\r\n" );
trace( " .hidden = " + item.hidden + " (boolean)\r\n" );
trace( " .visited = " + item.visited + " (boolean)\r\n" );
trace( " .canpurge = " + item.canpurge + " (boolean)\r\n" );
trace( " .alerting = " + item.alerting + " (boolean)\r\n" );
trace( " .creation = " + item.creation + " (double)\r\n" );
trace( " .pubdate = " + item.pubdate + " (double)\r\n" );
trace( " .lastmodified = " + item.lastmodified + " (double)\r\n" );
// Output the current value of each defined element in an item
trace( " .getData (\"level\") = \"" + item.getData( "level" ) + "\" (string)\r\n" );
trace( " .getData (\"sender\") = \"" + item.getData( "sender" ) + "\" (string)\r\n" );
trace( " .getData (\"summary\") = \"" + item.getData( "summary" ) + "\" (string)\r\n" );
trace( " .getData (\"date\") = \"" + item.getData( "date" ) + "\" (string)\r\n" );
trace( " .getData (\"category\") = \"" + item.getData( "category" ) + "\" (string)\r\n" );
trace( " .getData (\"url\") = \"" + item.getData( "url" ) + "\" (string)\r\n" );
trace( " .getData (\"id\") = \"" + item.getData( "id" ) + "\" (string)\r\n" );
trace( "\r\n" );
}
function show_all_prefs()
{
if (Prefs.length == 0)
{
trace ("There are no Prefs defined\r\n");
return;
}
trace( "------------------------\r\n" );
for (var i = 0; i < Prefs.length; i++)
{
trace("Prefs.getPref( \""+Prefs[i].name+"\" ) == \""+Prefs[i].value+"\"\r\n");
}
trace( "------------------------\r\n" );
}
function _t( s )
{
trace( s + "\r\n" );
}
]]>
</klipscript>
</klip>

onRefresh () -- http://www.serence.com/support/samples/demo/demo-
static.xml
Items[0]:
-----------------
.hidden = false (boolean)
.visited = false (boolean)
.canpurge = true (boolean)
.alerting = false (boolean)
.creation = 1217601846 (double)
.pubdate = 0 (double)
.lastmodified = 1217601846 (double)
.getData ("level") =
"http://www.serence.com/support/samples/images/high.png" (string)
.getData ("sender") = "Server Monitor" (string)
.getData ("summary") = "Server BU172 is down." (string)
.getData ("date") = "06/09/2008 20:29" (string)
.getData ("category") = "Category 1" (string)
.getData ("url") = "http://www.serence.com/" (string)
.getData ("id") = "1133054944" (string)
Items.Deleted[0]:
-----------------
.hidden = false (boolean)
.visited = false (boolean)
.canpurge = true (boolean)
.alerting = false (boolean)
.creation = 1217601846 (double)
.pubdate = 0 (double)
.lastmodified = 1217601846 (double)
.getData ("level") = "false" (string)
.getData ("sender") = "false" (string)
.getData ("summary") = "false" (string)
.getData ("date") = "false" (string)
.getData ("category") = "false" (string)
.getData ("url") = "false" (string)
.getData ("id") = "1133055050" (string)
There are no Prefs defined
| Properties Summary | |
integer |
expiry
Returns the number of days an unmodified item will remain in Items.Deleted[] before it is permanently removed. |
integer |
length
Returns the number of Item objects in the Items.Deleted array. |
| Function Summary | |
function
|
clear()
Clears all items from the Items.Deleted[] array. |
function
|
expiredeleteditems( index | object )
Removes any items in Items.Deleted array that have not been modified within expiry days. |
boolean
|
remove( <integer> index )
Removes the specified item from the Items.Deleted[] array. |
boolean
|
restore( <integer> index | <Item> object )
Restores the specified item from the Items.Deleted array to the Items array, thus making it visible again to the user. |
| Properties Detail |
expiry
integer expiry
-
Returns the number of days an unmodified item will remain in Items.Deleted[] before it is permanently removed.
If you set this value to 0, Klipfolio Dashboard will never remove items from Items.Deleted[] for this Klip.
length
integer length
-
Returns the number of Item objects in the Items.Deleted array. (read-only)
| Function Detail |
clear
function clear()
- Clears all items from the Items.Deleted[] array. These items are permanently destroyed.
expiredeleteditems
function expiredeleteditems( index | object )
- Removes any items in Items.Deleted array that have not been modified within expiry days.
remove
boolean remove( <integer> index )
- Removes the specified item from the Items.Deleted[] array. This item is permanently destroyed.
-
Parameters:
index - of the item to remove
-
Returns:
-
true if the deleted item could be found and removed; otherwise, returns false
restore
boolean restore( <integer> index | <Item> object )
- Restores the specified item from the Items.Deleted array to the Items array, thus making it visible again to the user.
-
Parameters:
index - of the item to restore
object - of the item to restore
-
Returns:
-
true if the previously deleted item could be found and restored the Klip's Items array; otherwise, returns false.
|
Klipfolio Dashboard 5 API | ||||||||
| PREV OBJECT NEXT OBJECT | FRAMES NO FRAMES | ||||||||
| SUMMARY: PROPERTY | FUNCTION | DETAIL: PROPERTY | FUNCTION | ||||||||
© 2009 Klipfolio Inc. All Rights Reserved.
