Changeset 1681 for MDService2
- Timestamp:
- 12/22/11 12:01:24 (12 years ago)
- Location:
- MDService2/branches/MDService_simple3
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js
r1664 r1681 221 221 SearchClause.prototype.initAutocomplete = function(){ 222 222 223 if (element_autocomplete.length == 0) return; 224 225 $(this.GetIndexInputTermset()).autocompleteArray(element_autocomplete,{ 223 if (element_autocomplete.length == 0) return; 224 225 $(this.GetIndexInputTermset()).autocomplete({ 226 source: element_autocomplete, 226 227 autoFill:true, 227 //width:150, 228 onFindValue:findValueTermset, 229 onItemSelect:selectItemTermset 230 }); 231 232 $('body').find('.ac_results').css({'z-index' : '1000'}); 228 width:150, 229 //onFindValue:findValueTermset, 230 //onItemSelect:selectItemTermset, 231 minLength: 0, 232 matchContains:true, 233 delay: 0, 234 select: function( event, ui ) { 235 $(this).data("item", ui.item); 236 selectItemTermset(ui.item); 237 } 238 }).data( "autocomplete" )._renderItem = function( ul, item ) { 239 var t, re; 240 if (this.term == ""){ 241 t = item.value; 242 } else { 243 re = new RegExp(this.term + "+") ; 244 t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" + 245 this.term + 246 "</span>"); 247 } 248 249 return $( "<li></li>" ) 250 .data( "item.autocomplete", item ) 251 .append( "<a>" + t + "</a>" ) 252 .appendTo( ul ); 253 }; 254 $('body').find('.ac_results').css({'z-index' : '1000'}); 233 255 234 256 }; … … 677 699 function findValueTerm(e) { 678 700 679 var sValue = e.selectValue;701 //var sValue = e.selectValue; 680 702 681 703 var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id"); 682 704 var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id"); 683 705 //alert(i+ ',' + j + sValue); 684 searchclauseset.searchclauses[i][j].index = sValue;706 searchclauseset.searchclauses[i][j].index = e.value; 685 707 686 708 //handleTermsSelection(i,j,sValue); … … 693 715 694 716 695 function initTermsetAutocomplete(i,j, elem){717 function initTermsetAutocomplete(i,j,index){ 696 718 //$('#' + 'sc' + i + '-' + j).find('.index-input').hide(); 697 719 … … 699 721 //searchclauseset.searchclauses[i][j].initAutocompleteTerms(elem); 700 722 701 $('#' + 'sc' + i + '-' + j).find('.index-input').autocompleteArray(elements_hashtable[elem],{ 723 $('#' + 'sc' + i + '-' + j).find('.index-input').autocomplete({ 724 source: element_autocomplete[index].data, 702 725 autoFill:true, 703 //width:150, 704 onFindValue:findValueTerm, 705 onItemSelect:selectItemTerm 706 }); 726 width:150, 727 //onFindValue:findValueTerm, 728 //onItemSelect:selectItemTerm, 729 minLength: 0, 730 matchContains:true, 731 delay: 0, 732 select: function( event, ui ) { 733 $(this).data("item", ui.item); 734 selectItemTerm(ui.item); 735 } 736 }).data( "autocomplete" )._renderItem = function( ul, item ) { 737 var t, re; 738 if (this.term == ""){ 739 t = item.value; 740 } else { 741 re = new RegExp(this.term + "+") ; 742 t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" + 743 this.term + 744 "</span>"); 745 } 746 747 return $( "<li></li>" ) 748 .data( "item.autocomplete", item ) 749 .append( "<a>" + t + "</a>" ) 750 .appendTo( ul ); 751 }; 752 753 707 754 // reset the index value 708 755 $('#' + 'sc' + i + '-' + j).find('.index-input').val(""); … … 711 758 $('body').find('.ac_results').css({'z-index' : '1000'}); 712 759 713 }; 714 760 761 $('.focused','#searchclauselist').find('.index-input').focus(); 762 763 764 }; 765 /* 715 766 function handleTermsetSelection(i,j,elem){ 716 767 … … 728 779 } 729 780 }; 730 731 function findValueTermset(e) { 732 var sValue = e.selectValue; 781 */ 782 783 function findValueTermset(elem) { 784 //var sValue = e.selectValue; 733 785 734 786 var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id"); … … 736 788 737 789 //searchclauseset.searchclauses[i][j].index = sValue; 738 handleTermsetSelection(i,j,sValue); 739 740 $('.focused','#searchclauselist').find('.index-input').focus(); 790 //handleTermsetSelection(i,j,sValue); 791 792 //find element 793 var index; 794 $.each(element_autocomplete,function(i, item){ 795 if (this.key == elem.key){ 796 index = i; 797 return; 798 } 799 }); 800 801 if (element_autocomplete[index].data.length == 0){ 802 jQuery.get(link('smc','list/?context=' + element_autocomplete[index].key),function(data){ 803 $(data).find('Term').each(function(i){ 804 element_autocomplete[index].data[i] = {label:$(this).text(), value:$(this).text(), id:$(this).attr("concept-id") }; 805 }); 806 initTermsetAutocomplete(i,j, index); 807 }); 808 } else { 809 initTermsetAutocomplete(i,j, index); 810 } 741 811 742 812 } … … 745 815 findValueTermset(li); 746 816 } 817 -
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_load.js
r1664 r1681 249 249 $('#termset_autocomplete').load(link('smc','list/?context=*'),function(){ 250 250 $(this).find('Termset').each(function(index){ 251 elem = $(this).children("key").text(); 252 element_autocomplete[index] = elem; 251 var _key, _name, _id, _parent, _isleaf = 0; 252 _key = $(this).children("key").text(); 253 _name = $(this).children("name").text(); 254 _parent = $(this).parents('Termset'); 255 _id = $(this).children("id").text(); 256 if ($(this).children('Termset').length == 0){ 257 _isleaf = 1; 258 } 259 260 element_autocomplete[index] = { label:_name, value:_name, key:_key, id:_id, parent:_parent, isleaf:_isleaf, data:[]}; 261 // obsolete 253 262 // create div for each element 254 elements_hashtable[elem] = new Array();//$(this).html()255 $('#terms_autocomplete').append($('<div/>').attr("id","elements_hashtable_" + elem));263 //elements_hashtable[elem] = new Array();//$(this).html() 264 //$('#terms_autocomplete').append($('<div/>').attr("id","elements_hashtable_" + elem)); 256 265 }); 257 266 // add autocomplete 's -
MDService2/branches/MDService_simple3/src/xsl/html_snippets.xsl
r1664 r1681 24 24 <link href="{$base_dir}/style/jquery/treetable/jquery.treeTable.css" rel="stylesheet" ></link> 25 25 <!-- <link href="{$base_dir}/style/jquery/jquery-textboxlist/TextboxList.css" rel="stylesheet" type="text/css"></link> --> 26 <link href="{$base_dir}/style/jquery/jquery-autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css"></link> 27 28 <script src="{$base_dir}/scripts/jquery/js/jquery-1.4.2.js" type="text/javascript"></script> 26 <!-- <link href="{$base_dir}/style/jquery/jquery-autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css"></link> --> 27 <link href="{$base_dir}/style/jquery/jquery-autocomplete/jquery-ui.css" rel="stylesheet" type="text/css"></link> 28 29 <!-- <script src="{$base_dir}/scripts/jquery/js/jquery-1.4.2.js" type="text/javascript"></script> 29 30 <script src="{$base_dir}/scripts/jquery/js/jquery-ui-1.8.5.custom.min.js" type="text/javascript"></script> 30 31 31 --> 32 <script src="{$base_dir}/scripts/jquery/js/jquery.min.js" type="text/javascript"></script> 33 <script src="{$base_dir}/scripts/jquery/js/jquery-ui.min.js" type="text/javascript"></script> 34 32 35 <script src="{$base_dir}/scripts/jquery/jquery-treeview/jquery.treeview.js" type="text/javascript"></script> 33 36 <script src="{$base_dir}/scripts/jquery/jquery-treeTable/jquery.treeTable.js" type="text/javascript"></script> … … 35 38 36 39 <script src="{$base_dir}/scripts/mdservice_helpers.js" type="text/javascript"></script> 37 < script src="{$base_dir}/scripts/jquery/jquery-autocomplete/jquery.autocomplete.js" type="text/javascript"></script>40 <!-- <script src="{$base_dir}/scripts/jquery/jquery-autocomplete/jquery.autocomplete.js" type="text/javascript"></script> --> 38 41 <script src="{$base_dir}/scripts/jquery/jquery-layout/jquery.layout-1.3.0.rc29.12.js" type="text/javascript"></script> 39 42
Note: See TracChangeset
for help on using the changeset viewer.