Correction fonctionnement champs de recherche

This commit is contained in:
Michael RICOIS 2013-01-09 16:58:17 +00:00
parent 15cdb9a46d
commit 4de758ca38
2 changed files with 22 additions and 18 deletions

View File

@ -26,7 +26,7 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$display = true;
$out = '';
//If more than one field exist we need to make a special display
if ( $nbFields > 1) {
$out.= '<div class="fieldgrp clearfix">';
@ -108,12 +108,12 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$html = $this->structureHTML($name, '');
break;
}
$label = $labelG;
if ( array_key_exists('label', $options) ) {
$label = $options['label'];
}
$style = '';
$class = ' class="fieldgrp"';
if ( $display===false ) {
@ -122,17 +122,17 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
if ( !empty($title) ) {
$title = ' title="'.$title.'"';
}
$out.= '<div id="field_'.$type.'_'.$this->name.'" '.$class.''.$style.''.$title.'>';
$out.= $this->structureLabel($label);
$out.= '<div class="field">'.$html.'</div>';
$out.= '</div>';
}
return $out;
}
/**
* Définition du label
* @param unknown_type $label
@ -346,7 +346,7 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
protected function textHTML($name, $options)
{
$return = '<input type="text" class="criteres autocomplete" name="'.$name.'" />';
$return.= '<ul id="selectqueries"></ul>';
$return.= '<ul id="'.$name.'" class="selectqueries"></ul>';
$return.= '<a href="#" class="autocomplete">Sélectionner</a>';
$return.= '&nbsp;<a href="#" class="autocompleteEx">Exclure</a>';
return $return;

View File

@ -1,10 +1,10 @@
$(document).ready(function()
{
$( "#tabs" ).tabs({
$('#tabs').tabs({
cookie: { expires: 1 }
});
$("div.fieldgrp").each(function(){
$('div.fieldgrp').each(function(){
var title = $(this).attr('title');
if (title) {
$(this).qtip({
@ -68,8 +68,7 @@ $(document).ready(function()
$('input[type=text].autocomplete')
.bind( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).data( "autocomplete" ).menu.active ) {
if ( event.keyCode === $.ui.keyCode.TAB && $(this).data("autocomplete").menu.active ) {
event.preventDefault();
}
})
@ -77,16 +76,21 @@ $(document).ready(function()
minLength:2,
source: function(request, response) {
var val = extractLast( request.term );
$.getJSON( '/fields/autocomplete', { q: val, name: this.element.attr('name') }, function(data) {
$.getJSON('/fields/autocomplete', { q: val, name: this.element.attr('name') }, function(data) {
response(data);
});
},
focus: function() { return false; },
select: function( event, ui ) {
if (ui.item.value != '') {
var oldhtml = $('ul#selectqueries').html();
if (ui.item.value != '') {
var name = $(this).parent().find('input.criteres').attr('name');
alert(name);
var selectObject = $('ul.selectqueries#'+name);
var oldhtml = selectObject.html();
var newhtml = '<li name="' + ui.item.value + '">' + ui.item.label + '</li>';
$('ul#selectqueries').html(oldhtml + newhtml);
selectObject.html(oldhtml + newhtml);
}
this.value = '';
return false;
@ -97,7 +101,7 @@ $(document).ready(function()
$('#tabs').delegate('a.autocomplete', 'click', function(e){
e.stopPropagation();
var name = $(this).parent().find('input.criteres').attr('name');
var ul = $(this).parent().find('ul#selectqueries');
var ul = $(this).parent().find('ul.selectqueries');
var values = new Array();
if ($('li', ul).length>0) {
$('li', ul).each(function(){
@ -111,7 +115,7 @@ $(document).ready(function()
$('#tabs').delegate('a.autocompleteEx', 'click', function(e){
e.stopPropagation();
var name = $(this).parent().find('input.criteres').attr('name');
var ul = $(this).parent().find('ul#selectqueries');
var ul = $(this).parent().find('ul.selectqueries');
var values = new Array();
if ($('li', ul).length>0) {
$('li', ul).each(function(){