On the client side, you can save the state of all helping controls (typically filters, see event filtering) in .clientState property.

Whatever you assign to this property on the client side is sent to the server with all the CallBacks (and accessible as ClientState). In this example, clientState is used to send the text from the filter input box with all the requests so the results can be filtered properly.

Objects assigned to clientState are transformed to JsonData objects (see also Sending custom data with callback).

Example (set the client state in JavaScript):

dps1.clientState.filter = "sales";

Example (read the client state on the server side):

string filter = (string) DayPilotScheduler1.ClientState["filter"];

Complex objects

The clientState object will be serialized using a modified json.org serializer.

You should avoid adding complex objects with deep children structures and circular references.

Serialization of complex objects can be handled by providing toJSON() method:

var r = {};
r.root = calendar; // to be skipped during serialization
r.filter = 'text';
r.toJSON = function(key) {
  var json = {};
  json.filter = this.filter;
  return json;
};

dps.clientState = r;

See also