function shareReloadData()
{
    var self = this;
    var templateRow = this.templateRowElement;
	if (!templateRow) return;
    var useTemplateAsRow = dashcode.inDesign;
    
    if (!useTemplateAsRow) {
        templateRow.style.visibility = "hidden";
        templateRow.style.display = "";
    }
    
    // remove all children except for the template row
	var list = this.element;
    var child = list.firstChild;
	var dataSource = this.dataSource;
    
    while (child) {
        var nextChild = child.nextSibling;
        if (child != templateRow) {
            list.removeChild(child);
        }
        child = nextChild;
    }
    this.rows = [];
    
    var cloneAndStyleRow = function(rowIndex, numRows, listStyle) {
        // clone the template DOM node
        var newRowElement = dashcode.cloneTemplateElement(templateRow, useTemplateAsRow && rowIndex == 0);
        // style the new row
        if (newRowElement.style.visibility == "hidden") {
            newRowElement.style.visibility = "visible";
        }
        if (listStyle == List.ROUNDED_RECTANGLE) {
            newRowElement.style.borderTopWidth = rowIndex > 0 ? "1px" : "0px";
        }
        return newRowElement;
    }
    
    var insertRow = function(rowElement, rowIndex, value) {
        // save index and value in row's object
        if (rowElement != templateRow && rowElement.object) {
            rowElement.object.index = rowIndex;
            rowElement.object.value = value;
        }        
        // insert into the DOM
        if (!useTemplateAsRow) {
            list.insertBefore(rowElement, templateRow);
        } else {
            list.appendChild(rowElement);
        }
		
        // handle click events with TouchButtonEventHandler for better user feedback
        if (rowElement.onclick) {
            rowElement.object.buttonEventHandler = dashcode.CreateTouchButtonEventHandler(rowElement,rowElement.onclick);
            rowElement.object.buttonEventHandler.highlightCallback = function(highlight) { self._setHighlight(rowElement,highlight); };
            rowElement.onclick = null;
        }
		
		if( dataSource && dataSource.rowSwiped ){
			rowElement.object.buttonEventHandler.swipeCallback = function(event,xDelta) { return dataSource.rowSwiped(rowElement,event,xDelta); };
		}
		
        self.rows.push(rowElement);
    }
    
    var dataArray = this.dataArray;
    if (this._useDataSource) {
        // using dynamic data from a datasource
        var numRows = dashcode.inDesign ? this._sampleRows : 0;        
        if (dataSource && dataSource.numberOfRows) {
            numRows = dataSource.numberOfRows();
        }
		
        for (var rowIndex=0; rowIndex<numRows; rowIndex++) {
			var newRowElement = cloneAndStyleRow(rowIndex, numRows, this._listStyle);
            
            // hand the new row to the data source to process it and insert the data
            if (dataSource && dataSource.prepareRow) {
                dataSource.prepareRow(newRowElement, rowIndex, newRowElement.object.templateElements);
            }
            
            insertRow(newRowElement, rowIndex);
        }
    } else if(dataArray) {
        // using static data from a data array
        var numRows = this.dataArray.length;
        var startRow = this.currentPage*this.numberOfRowsPerPage-this.numberOfRowsPerPage;
        var endRow = startRow + this.numberOfRowsPerPage;
        endRow = (endRow > numRows) ? numRows : endRow;
        if (this.search != null) endRow = numRows;
        for (var rowIndex = startRow; rowIndex < endRow; rowIndex++) {
            var newRowElement = cloneAndStyleRow(rowIndex, numRows, this._listStyle);
            // process the new row to insert the data
            var templateElements = newRowElement.object.templateElements;
            var labelElement = null;
            for (var key in templateElements) {
                // try to find the label element
                if (this._labelElementId && this._labelElementId.length > 0 && key.indexOf(this._labelElementId) == 0) { 
                    labelElement = templateElements[key];
                    break;
                }
            }
            // get the text and value
            var itemLabel = '';
            var itemValue = '';
            if ((dataArray[rowIndex]) instanceof Array) {
                if (dataArray[rowIndex].length > 0) {
                    var indexLabel = rowIndex+1;
                    itemLabel = "<font size='-5'>" + indexLabel + " </font> " + dataArray[rowIndex][0];
                    if (dataArray[rowIndex].length > 1) {
                        itemValue = dataArray[rowIndex][1];
                    }
                }
            }
            else {
                itemLabel = dataArray[rowIndex];
                itemValue = itemLabel;
            }
            // assign the label and insert it
            if (labelElement) {
                labelElement.innerHTML = itemLabel;
            }
            var ignoreSearch = this.search == null;
            var match = true;
            if (ignoreSearch == false) match = itemValue.name.toLowerCase().search(this.search.toLowerCase()) != -1;

            if (ignoreSearch || match) {
            insertRow(newRowElement, rowIndex, itemValue);
            }
        }
    }
    
    if (!useTemplateAsRow) {
        templateRow.style.display = "none";
    }
    // show the list after the data is loaded
    if (dashcode.inDesign) {
        setTimeout(function() {list.style.display = "block";}, 0);
    } else {
        list.style.display = "block";
    }
    
    // if it is inside a scroll area, notify it of the change
    if (typeof(AppleScrollArea) != "undefined") {
        var scrollElement = list.parentNode;
        while (scrollElement && scrollElement != document) {
            if (scrollElement.object && scrollElement.object.constructor == AppleScrollArea) {
                scrollElement.object.refresh();
                break;
            }
            scrollElement = scrollElement.parentNode;
        }
    }
}


