Wijmo User Guide > Concepts > Object Notation |
There are different ways of using code with Wijmo
Code sample using object notation:
productsTable.adapter = new wijmo.data.DataTableAdapter("", { get: { url: "http://server.com/products" }, insert: { url: "http://server.com/newproduct" }, update: { url: "http://server.com/editproduct?id={id}" }, remove: { url: "http://server.com/deleteproduct?id={id}" } });
If there are no other properties set, you don't have to use the object notation with the 'url' property. It can be written like the following code sample, without using object notation:
get: "http://server.com/products", insert: http://server.com/newproduct,
Object notation is useful when you want to override some of the settings for a particular operation.
You can see this in the following sample:
dataTable.filter({ rating: { operator: ">=", value: 4.2 } }); dataTable.orderBy(["rating", "-year" ]); dataTable.pageSize(5); dataTable.load();
Because these actions are done on the server, they don't take effect until 'load' is called. Setting these properties and calling 'load' can be chained like this:
dataTable.filter({ rating: { operator: ">=", value: 4.2 } }).orderBy(["rating", "-year" ]).pageSize(5).load();