search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

The Apply link is not working for Fast Filter

Asked by Kathy
11 years ago.

Hi Dan,
Hope all is well.
I'm am having problems with the javascript:filter(); for the the apply link for the Scheduler. I searched throughout the site and can't seem to find out what I am doing wrong. Below is what I have:
/* Fast filter helpers */
function clear() {
var filterBox = document.getElementById("TextBoxFilter");
filterBox.value = '';
function filter() {
var filterBox = document.getElementById("TextBoxFilter");
var filterText = filterBox.value;
dps1.clientState = {"filter": filterText};
function key(e) {
var keynum = (window.event) ? event.keyCode : e.keyCode;
if (keynum === 13) {
filter(); return false;
return true;
<div style="margin-bottom:5px"><b>Fast filter:</b>
<input type="text" id="TextBoxFilter" onkeypress="return key(event);" />&nbsp;
<a href="javascript:filter();" style="font-weight:bold">Apply</a>
&nbsp;<a href="javascript:clear();">Clear</a></div>

private void setDataSourceAndBind()
// ensure that filter is loaded
string filter = (string)DayPilotScheduler1.ClientState["filter"];
DayPilotScheduler1.DataSource = getData(DayPilotScheduler1.StartDate, DayPilotScheduler1.EndDate.AddDays(1), filter);

private DataTable getData(DateTime start, DateTime end, string filter)
SqlCommand cmd = new SqlCommand();
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["_____"].ConnectionString);
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT DISTINCT [id], [name], [eventstart], [eventend], [resource_id] FROM event WHERE NOT ((eventend <= @start) OR (eventstart >= @end))";
cmd.Parameters.AddWithValue("@start", start);
cmd.Parameters.AddWithValue("@end", end);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
String select;
if (String.IsNullOrEmpty(filter))
select = String.Format("NOT (([eventend] <= '{0:s}') OR ([eventstart] >= '{1:s}'))", start, end);
select = String.Format("NOT (([eventend] <= '{0:s}') OR ([eventstart] >= '{1:s}')) and [name] like '%{2}%'", start, end, filter);
//throw new Exception(select);
DataRow[] rows = dt.Select(select);
DataTable filtered = dt.Clone();
foreach (DataRow r in rows)
return filtered;

case "filter":
//string filter = (string)e.Data;
//DayPilotScheduler1.DataSource = getData(DayPilotScheduler1.StartDate, DayPilotScheduler1.EndDate.AddDays(1), filter);
return; // note that the binding done inside the case section here

When I click on Apply nothing happens. The clear link works.
Please advise thanks!

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.