Data scheme allows to set a default scheme for data records of dhtmlXDataStore. So, in cases when you add an empty record to dhtmlXDataStore (data.add({})), the record will be populated with the values set by the scheme.
myDataStore.data.scheme({ name:"Unknown", gender:"male", age:25, department: "Unknown" }); myDataStore.add({});//will add { name:"Unknown", gender:"male", age:25, department:"Unknown"} record
Also, there are 2 special keys you can use in a scheme:
myDataStore.data.scheme({ $init:function(obj){ obj.value = obj.name;// 'name' is the name of the column from the db obj.text = obj.name; } });
myDataStore.data.scheme({ $update:function(obj){ obj.text = obj.name + " " + obj.number; } });