Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cto
g1
Commits
d8ae1028
Commit
d8ae1028
authored
Jul 03, 2018
by
S Anand
Browse files
DOC: update FormHandler docs that were repeated [skip ci]
@tejesh.p
parent
5c9ff00b
Pipeline
#53065
skipped
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
d8ae1028
...
...
@@ -365,7 +365,7 @@ Rules:
For example:
```
js
var
data
1
=
[
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
(
data
1
,
{
'
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
...
...
src/formhandler.js
View file @
d8ae1028
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment