// function to init the filtering capability
function initFilter(oResp,oDataTable,c){
    var data= oDataTable.getRecordSet().getRecords()
    fnFilter= new YAHOO.dpu.util.StringFilter(data,"method")
    fnFilter.maxCacheEntries = 0;
    oAutoComp = new YAHOO.dpu.widget.RowFilter('dt_input','dt_ac_container', oDataTable, fnFilter);
    var ua = navigator.userAgent.toLowerCase();
    if(ua.indexOf('msie') != -1 && ua.indexOf('opera') < 0) {
        oAutoComp.useIFrame = true;
    }
	oDataTable.unsubscribe("initEvent",initFilter)
} 

// changes the field that the table will be filtered by
function changeFilter() {
    var s = document.getElementById("fs");
    var column= s.options[s.selectedIndex].value;
    fnFilter.schemaItem=column
    
}

// makes the static table interactive
function init(tableId, myColumnDefs, responseSchema, config, strDomGet) {
        // This defines the columns of the Data Table. 
	// Sortable makes the header of the column clickable. One click sorts the table by that column in ascendence order. Another click reverses the order.
	// Hideable allows the user to select this column as visible or hidden by right-clicking the table header. 
	// this creates a DataSource out of the HTML table

	// var config -> configuration variable for the interactive table

        var myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get(strDomGet));

        myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;

        myDataSource.responseSchema = responseSchema;

	
		
	// creates the interactive table
        myDataTable = new YAHOO.widget.DataView(tableId, new YAHOO.widget.ColumnSet(myColumnDefs), myDataSource, config);
		
	// Configuring the filter
	myDataTable.subscribe("initEvent", initFilter, myDataTable);

}

//YAHOO.util.Event.onAvailable("datasource", function(){init("datasource")});

