Commit 4b640293 authored by Bertrand  NÉRON's avatar Bertrand NÉRON

add new widget to query db with t3ss family criteria

parent 0789d2ee
......@@ -24,12 +24,19 @@
<input type="text" name="taxidSearch" id="taxidInput"/>
<button type="button" id="taxidButton">search by taxid</button>
</fieldset>
<fieldset>
<label for="famillySearch">by T3SS family (ex:Hrp2)</label>
<input type="text" name="familySearch" id="familyInput"/>
<button type="button" id="familyButton">search by family</button>
</fieldset>
<fieldset>
<label for="famillySearch2">by T3SS family (ex:Hrp2)</label>
<select name="familySearch2" id="familyList">
</select>
</fieldset>
</form>
</div>
<div id="results">
</div>
<div id="results"></div>
</body>
<script type="text/javascript">
$(".tooltip" , "#results").live('mouseenter', function(){
......@@ -47,14 +54,15 @@ $(".tooltip" , "#results").live('mouseenter', function(){
<script type="text/javascript">
var get_results = function( view , args ){
var url= document.location.href.split('/').slice(0, -1).concat(['_list','index',view]).join('/');
$("#results").load(url , args );
var url = ['_list','index',view].join('/');
args.limit= 45+1;
$("#results").load(url , $.param(args) );
}
$("#nameButton").click( function(){
var params = {limit:45+1};
var params = {};
var $query= $("#nameQueryType").attr("value")
if ( $query == "start_with" ){
var key= $("#nameInput").attr("value");
var key= $.trim($("#nameInput").attr("value"));
if( key ){
params.startkey='"'+key+'"';
params.endkey='"'+key+'\uFFFF"';
......@@ -64,14 +72,37 @@ $(".tooltip" , "#results").live('mouseenter', function(){
var key= $("#nameInput").attr("value");
if( key ){ params.key='"'+key+'"'}
}
get_results( 'by_replicon_name', $.param(params));
get_results( 'by_replicon_name', params);
});
$("#taxidButton").click( function(){
var params = {limit:45+1};
var key= $("#taxidInput").attr("value");
if( key ){ params.key=key}
get_results( 'by_replicon_taxid', $.param(params));
var params = {};
var key= $.trim($("#taxidInput").attr("value"));
if( key ){ params.key = key}
get_results( 'by_replicon_taxid', params);
});
$("#familyButton").click( function(){
var params = {};
var key= $.trim($("#familyInput").attr("value"));
if( key ){ params.key='"'+key+'"'}
get_results( 'by_family', $.param(params));
});
$.getJSON( "_view/t3ss_family" , {group:true}, function(response){
var html = '<option value="">chose a T3SS Family</option>\n';
for ( var i=0 ; i< response.rows.length ; i++){
html = html+'<option value="'+response.rows[i].key+'">'+response.rows[i].key+'</option>\n';
}
$("#familyList").html( html );
$("#familyList").change(function(event){
var opt_value = $(event.target).val();
if ( opt_value){
var params = {};
params.key='"'+opt_value+'"'
get_results( 'by_family', params );
}
});
});
$("#paginate .nav_page").live( 'click', function(){
......
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