// JavaScript Document
var pvds4 = new Spry.Data.PagedView(ds4, { pageSize: 7 });
var pvds4PagedInfo = pvds4.getPagingInfo();

// FilterData() and StartFilterTimer() are not required for paging at all. They are
// here only to support the filtering function used within this sample to show that
// the PagedView automatically adjusts paging as the data in the data set it depends
// on changes dynamically.

function FilterData()
{
	var tf = document.getElementById("filterTF");
	if (!tf.value)
	{
	

		ds4.filter(null);
		return;
	}


	var regExpStr = tf.value;
	
	if (!document.getElementById("containsCB").checked)
		regExpStr = "^" + regExpStr;

	var regExp = new RegExp(regExpStr, "i");
	
	var filterFunc = function(ds, row, rowNumber)
	{
		var str = row["name"];
		if (str && str.search(regExp) != -1)
			return row;
		return null;
	};

	ds4.filter(filterFunc);
}

function StartFilterTimer()
{
	if (StartFilterTimer.timerID)
		clearTimeout(StartFilterTimer.timerID);
	StartFilterTimer.timerID = setTimeout(function() { StartFilterTimer.timerID = null; FilterData(); }, 100);
}