Commit bfcdcffd authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Ajout d'un delai pour la recherche

parent e5ce5722
Loading
Loading
Loading
Loading
+3 −3

File changed.

Preview size limit exceeded, changes collapsed.

+7 −0
Changes for public/js/oscar/src/OrganizationAutoCompleter.vue: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
<script>
    import OscarBus from './OscarBus.js';

  let tempo;

    export default {
        data(){
            return {
@@ -30,7 +32,12 @@
        watch: {
            expression(n, o){
                if( n.length >= 2 ){
                    if(tempo){
                      clearTimeout(tempo);
                    }
                    tempo = setTimeout( () => {
                      this.search();
                    }, 500)
                }
            }
        },
+11 −1
Changes for public/js/oscar/src/PersonAutoCompleter.vue: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -4,7 +4,9 @@
    <span v-show="loading">
            <i class="icon-spinner animate-spin"></i>
        </span>
        <div class="choose" style="position: absolute; z-index: 3000; max-height: 400px; overflow: hidden; overflow-y: scroll" v-show="persons.length > 0 && showSelector">
    <div class="choose"
         style="position: absolute; z-index: 3000; max-height: 400px; overflow: hidden; overflow-y: scroll"
         v-show="persons.length > 0 && showSelector">
      <div class="choice" :key="c.id" v-for="c in persons" @click.prevent.stop="handlerSelectPerson(c)">
        <div style="display: block; width: 50px; height: 50px">
          <img :src="'https://www.gravatar.com/avatar/'+c.mailMd5+'?s=50'" :alt="c.displayname" style="width: 100%"/>
@@ -24,6 +26,7 @@
</template>
<script>
//import OscarBus from './OscarBus.js';
let tempo;

export default {
  data() {
@@ -39,8 +42,15 @@
  },
  watch: {
    expression(n, o) {

      if (n.length >= 2) {
        if (tempo) {
          clearTimeout(tempo);
        }
        tempo = setTimeout(() => {
          this.search();
        }, 500)

      }
    }
  },