Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
b63ed41b
Commit
b63ed41b
authored
May 02, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removing custom search abstract addition from jquery.dynatables lib
parent
ae87eb6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
81 deletions
+17
-81
Docs_dyna_chart_and_table.js
static/js/gargantext/Docs_dyna_chart_and_table.js
+13
-35
jquery.dynatable.js
static/js/jquery/jquery.dynatable.js
+4
-46
No files found.
static/js/gargantext/Docs_dyna_chart_and_table.js
View file @
b63ed41b
...
...
@@ -437,9 +437,9 @@ function Main_test( Data , SearchFilter ) {
pushState
:
false
,
// sort: false //i need to fix the sorting function... the current one just sucks
},
inputs
:
{
queries
:
$
(
'#searchInAbstract
'
)
},
//
inputs: {
// queries: $('#searchAB
')
//
},
writers
:
{
_rowWriter
:
ulWriter
// _cellWriter: customCellWriter
...
...
@@ -461,38 +461,16 @@ function Main_test( Data , SearchFilter ) {
$
(
""
+
the_content
).
insertAfter
(
"#dynatable-query-search-my-ajax-table"
)
// bind a filter named 'searchInAbstract' to dynatable.queries.functions
MyTable
.
data
(
'dynatable'
).
queries
// selects on abstract value
.
functions
[
'searchInAbstract'
]
=
function
(
record
,
searchInAbstractContents
)
{
// probably useful for condition
console
.
log
(
"searchInAbstractContents:"
+
searchInAbstractContents
)
// we want same searchString as in main query box
// searchString = $("#dynatable-query-search-my-ajax-table").val()
searchString
=
$
(
"#searchInAbstract"
).
val
()
console
.
log
(
"searching '"
+
searchString
+
"' in abstract for record"
)
console
.
log
(
record
)
console
.
log
(
record
.
hyperdata
.
abstract
.
indexOf
(
searchString
))
return
(
record
.
hyperdata
.
abstract
.
indexOf
(
searchString
)
!=
-
1
)
}
MyTable
.
data
(
'dynatable'
).
process
// ----------------------------- ???
$
(
'#searchAB'
).
click
(
function
()
{
if
(
$
(
this
).
is
(
':checked'
))
{
console
.
log
(
"Do stuff"
)
$
(
"#dynatable-query-search-my-ajax-table"
).
keyup
(
function
(
e
)
{
if
(
e
.
keyCode
==
13
)
{
console
.
log
(
"Do stuff: Just pressed ENTER"
)
}
})
}
});
// ----------------------------- ???
// $('#searchAB').click( function() {
// if($(this).is(':checked')) {
// console.log( "Do stuff")
// $("#dynatable-query-search-my-ajax-table").keyup(function (e) {
// if (e.keyCode == 13) {
// console.log("Do stuff: Just pressed ENTER")
// }
// })
// }
// });
// MyTable.data('dynatable').settings.inputs.queries = { $('#searchAB') }
// .insertAfter("#dynatable-query-search-my-ajax-table")
...
...
static/js/jquery/jquery.dynatable.js
View file @
b63ed41b
...
...
@@ -206,7 +206,7 @@
};
processAll
=
function
(
skipPushState
)
{
if
(
$
(
"#multiple_selection"
).
length
>
0
)
$
(
"#multiple_selection"
)[
0
].
checked
=
false
;
...
...
@@ -1177,51 +1177,9 @@
}
}
// collect all records that return true for query
if
(
$
(
'input[name=searchAB]:checked'
).
length
==
0
)
{
settings
.
dataset
.
records
=
$
.
map
(
settings
.
dataset
.
records
,
function
(
record
)
{
return
_this
.
functions
[
query
](
record
,
value
)
?
record
:
null
;
});
}
else
{
var
pageurl
=
window
.
location
.
href
.
split
(
"/"
)
var
cid
;
for
(
var
i
in
pageurl
)
{
if
(
pageurl
[
i
]
==
"corpus"
)
{
cid
=
parseInt
(
i
);
break
;
}
}
var
corpus_id
=
pageurl
[
cid
+
1
];
var
search_api
=
window
.
location
.
origin
+
"/v1.0/nodes/"
+
corpus_id
+
"/children/ids?limit="
+
(
settings
.
dataset
.
records
.
length
)
+
"&contain="
+
encodeURI
(
value
.
toLowerCase
())
var
coincidences_
=
[]
$
.
ajax
({
type
:
"GET"
,
url
:
search_api
,
dataType
:
"json"
,
async
:
false
,
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
var
results_
=
{}
if
(
data
.
pagination
.
total
>
0
)
{
for
(
var
i
in
data
.
data
)
{
results_
[
data
.
data
[
i
].
id
]
=
true
}
for
(
var
i
in
settings
.
dataset
.
records
)
{
if
(
results_
[
settings
.
dataset
.
records
[
i
].
id
]
)
{
coincidences_
.
push
(
settings
.
dataset
.
records
[
i
]
)
}
}
}
},
error
:
function
(
exception
)
{
console
.
log
(
"error in abstracts-API:"
);
console
.
log
(
exception
)
console
.
log
(
" - - - -- - - -"
)
}
})
console
.
log
(
"abstracts-API: "
+
coincidences_
.
length
)
settings
.
dataset
.
records
=
coincidences_
}
settings
.
dataset
.
records
=
$
.
map
(
settings
.
dataset
.
records
,
function
(
record
)
{
return
_this
.
functions
[
query
](
record
,
value
)
?
record
:
null
;
});
}
}
settings
.
dataset
.
queryRecordCount
=
obj
.
records
.
count
();
...
...
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