Commit d8ae1028 authored by S Anand's avatar S Anand
Browse files

DOC: update FormHandler docs that were repeated [skip ci] @tejesh.p

parent 5c9ff00b
Pipeline #53065 skipped
......@@ -365,7 +365,7 @@ Rules:
For example:
```js
var data1 = [
var data = [
{"ID": "1", "product": "Fan", "sales": "100", "city": "NY"},
{"ID": "2", "product": "Fan", "sales": "80", "city": "London"},
{"ID": "3", "product": "Fan", "sales": "120", "city": "NJ"},
......@@ -379,27 +379,10 @@ g1.datafilter(data, {
'city': ['London', 'NJ'],
'product': ['Fan']
})
g1.datafilter(data, {
'datsetname2:city': ['London', 'NJ'],
'sales>~': [100],
'datsetname1:product': ['Fan']
}, 'datsetname1'))
// ignores datsetname2:city: ['London', 'NJ']
// Returns [{"ID": "3", "product": "Fan", "sales": "120", "city": "NJ"}, {"ID": "4", "product": "Fan", "sales": "130", "city": "London"}, {"ID": "1", "product": "Fan", "sales": "100", "city": "NY"}]
var data2 = [
{"ID": "1", "city": "NY"},
{"ID": "2", "city": "London"},
{"ID": "3", "city": "NJ"},
{"ID": "4", "city": "London"},
{"ID": "5", "city": "NY"},
{"ID": "5", "city": "London"}
]
// Returns [{"ID": "3", "product": "Fan", "sales": "120", "city": "NJ"}, {"ID": "4", "product": "Fan", "sales": "130", "city": "London"}]
```
g1.datafilter with multiple datasets:
```js
var data1 = [
{"ID": "1", "product": "Fan", "sales": "100", "city": "NY"},
......@@ -419,7 +402,7 @@ var data2 = [
{"ID": "5", "city": "London"}
]
g1.datafilter(data, {
g1.datafilter(data1, {
'datsetname2:city': ['London', 'NJ'],
'sales>~': [100],
'datsetname1:product': ['Fan']
......@@ -428,14 +411,6 @@ g1.datafilter(data, {
// Returns [{"ID": "3", "product": "Fan", "sales": "120", "city": "NJ"}, {"ID": "4", "product": "Fan", "sales": "130", "city": "London"}, {"ID": "1", "product": "Fan", "sales": "100", "city": "NY"}]
var data2 = [
{"ID": "1", "city": "NY"},
{"ID": "2", "city": "London"},
{"ID": "3", "city": "NJ"},
{"ID": "4", "city": "London"},
{"ID": "5", "city": "NY"},
{"ID": "5", "city": "London"}
]
g1.datafilter(data2, {
'datsetname2:city': ['London', 'NJ'],
......@@ -453,18 +428,6 @@ g1.datafilter(data2, {
// ]
```
g1.datafilter with multiple datasets:
```js
var data1 = [
{"ID": "1", "product": "Fan", "sales": "100", "city": "NY"},
{"ID": "2", "product": "Fan", "sales": "80", "city": "London"},
{"ID": "3", "product": "Fan", "sales": "120", "city": "NJ"},
{"ID": "4", "product": "Fan", "sales": "130", "city": "London"},
{"ID": "5", "product": "Light", "sales": "500", "city": "NY"},
{"ID": "5", "product": "Light", "sales": "100", "city": "London"}
]
- `data`: a list of objects
- `filters`: [formhandler filters][formhandler-filters] extracted using
`g1.url.parse(url).searchList`. This converts `?city=London&sales>=1000` to
......
......@@ -274,7 +274,7 @@ function addHandler($this, template_data, options, template) {
$.ajax(options.src, {
method: 'POST',
dataType: 'json',
data: data,
data: data
}).fail(function (xhr, status, message) {
$this.html(template['error']({
message: message
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment